diff options
| -rw-r--r-- | src/ldap2csv.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ldap2csv.c b/src/ldap2csv.c index 1308b07..7faf38e 100644 --- a/src/ldap2csv.c +++ b/src/ldap2csv.c | |||
| @@ -311,6 +311,17 @@ int my_config(int argc, char * argv[], MyConfig ** cnfp) | |||
| 311 | 311 | ||
| 312 | cnf->prog_name = ldaputils_get_prog_name(cnf->lud); | 312 | cnf->prog_name = ldaputils_get_prog_name(cnf->lud); |
| 313 | 313 | ||
| 314 | // saves filter | ||
| 315 | if (argc > optind) | ||
| 316 | { | ||
| 317 | cnf->lud->filter = "(objectclass=*)"; | ||
| 318 | if ((index(argv[optind], '=')) != NULL) | ||
| 319 | { | ||
| 320 | cnf->lud->filter = argv[optind]; | ||
| 321 | optind++; | ||
| 322 | }; | ||
| 323 | }; | ||
| 324 | |||
| 314 | // checks for required arguments | 325 | // checks for required arguments |
| 315 | if (argc < (optind+1)) | 326 | if (argc < (optind+1)) |
| 316 | { | 327 | { |
| @@ -320,14 +331,6 @@ int my_config(int argc, char * argv[], MyConfig ** cnfp) | |||
| 320 | return(1); | 331 | return(1); |
| 321 | }; | 332 | }; |
| 322 | 333 | ||
| 323 | // saves filter | ||
| 324 | cnf->lud->filter = "(objectclass=*)"; | ||
| 325 | if ((index(argv[optind], '=')) != NULL) | ||
| 326 | { | ||
| 327 | cnf->lud->filter = argv[optind]; | ||
| 328 | optind++; | ||
| 329 | }; | ||
| 330 | |||
| 331 | // configures LDAP attributes to return in results | 334 | // configures LDAP attributes to return in results |
| 332 | len = (size_t)(argc - optind) + 1; | 335 | len = (size_t)(argc - optind) + 1; |
| 333 | size = sizeof(char *) * len; | 336 | size = sizeof(char *) * len; |
