]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/xmap.c
happy new year
[openldap] / libraries / librewrite / xmap.c
index 93bf53304b6b25cb0cc062d02fe1d7824edc0987..4e2965aa42f9f3d20aade6507ef62febe2fba48c 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2003 The OpenLDAP Foundation.
+ * Copyright 2000-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,7 @@ rewrite_xmap_parse(
         * Experimental file map:
         * looks up key in a `key value' ascii file
         */
-       } else if ( strncasecmp(s, "xfile", 5 ) == 0 ) {
+       } else if ( strncasecmp( s, "xfile", 5 ) == 0 ) {
                char *filename;
                const char *p;
                int l;
@@ -214,7 +214,8 @@ rewrite_xmap_parse(
        
        /* Unhandled map */
        }
-       
+
+       free( map );
        return NULL;
 }
 
@@ -259,11 +260,11 @@ rewrite_xmap_apply(
                        ldap_pvt_thread_mutex_unlock( &xpasswd_mutex );
 #endif /* USE_REWRITE_LDAP_PVT_THREADS */
 
-                       rc = REWRITE_NO_SUCH_OBJECT;
+                       rc = LDAP_NO_SUCH_OBJECT;
                        break;
                }
 
-#ifdef HAVE_PW_GECOS
+#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
                if ( pwd->pw_gecos != NULL && pwd->pw_gecos[0] != '\0' ) {
                        int l = strlen( pwd->pw_gecos );
                        
@@ -279,7 +280,7 @@ rewrite_xmap_apply(
                        }
                        val->bv_len = l;
                } else
-#endif /* HAVE_PW_GECOS */
+#endif /* HAVE_STRUCT_PASSWD_PW_GECOS */
                {
                        val->bv_val = strdup( key->bv_val );
                        val->bv_len = key->bv_len;
@@ -437,8 +438,8 @@ rewrite_xmap_destroy(
 {
        struct rewrite_map *map;
 
-       assert( pmap );
-       assert( *pmap );
+       assert( pmap != NULL );
+       assert( *pmap != NULL );
 
        map = *pmap;