X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibrewrite%2Fmap.c;h=7ddd0d99dd1911b05bbf324e5ceb96dc3a2b69c1;hb=79cc61f2ca194b68a059d921df404ddb8cd2531c;hp=2180d8907757164816ad4c23e19b8babe54a5fe2;hpb=72e111301bd276a6e1ef9846a9f9e4c2634972e3;p=openldap diff --git a/libraries/librewrite/map.c b/libraries/librewrite/map.c index 2180d89077..7ddd0d99dd 100644 --- a/libraries/librewrite/map.c +++ b/libraries/librewrite/map.c @@ -24,6 +24,8 @@ #include +#include + #ifdef HAVE_PWD_H #include #endif @@ -245,19 +247,20 @@ rewrite_map_parse( for ( p = string, cnt = 1; p[ 0 ] != '\0' && cnt > 0; p++ ) { if ( p[ 0 ] == REWRITE_SUBMATCH_ESCAPE ) { /* - * '\' marks the beginning of a new map + * '%' marks the beginning of a new map */ if ( p[ 1 ] == '{' ) { cnt++; /* - * '\' followed by a digit may mark the beginning + * '%' followed by a digit may mark the beginning * of an old map */ } else if ( isdigit( (unsigned char) p[ 1 ] ) && p[ 2 ] == '{' ) { cnt++; p++; } - p++; + if ( p[ 1 ] != '\0' ) + p++; } else if ( p[ 0 ] == '}' ) { cnt--; } @@ -540,6 +543,7 @@ rewrite_xmap_apply( break; } +#ifdef HAVE_PW_GECOS if ( pwd->pw_gecos != NULL && pwd->pw_gecos[0] != '\0' ) { int l = strlen( pwd->pw_gecos ); @@ -554,7 +558,9 @@ rewrite_xmap_apply( break; } val->bv_len = l; - } else { + } else +#endif /* HAVE_PW_GECOS */ + { val->bv_val = strdup( key->bv_val ); val->bv_len = key->bv_len; } @@ -626,7 +632,7 @@ rewrite_xmap_apply( case REWRITE_MAP_XLDAPMAP: { LDAP *ld; - char filter[ LDAP_FILT_MAXSIZ ]; + char filter[1024]; LDAPMessage *res = NULL, *entry; LDAPURLDesc *lud = ( LDAPURLDesc * )map->lm_args; int attrsonly = 0;