[ldapvi] Patch for -y/--password-file cmdline argument
David Bartley
dtbartle at csclub.uwaterloo.ca
Thu May 17 02:23:47 CEST 2007
This patch adds the ability to specify a password file. It works the same
way that ldapsearch -y works.
-------------- next part --------------
diff -r ldapvi-1.7/arguments.c ldapvi-1.7-dtbartle/arguments.c
42a43
> " -y, --password-file FILE Password file (also valid for SASL).\n" \
133a135
> {"password-file", 'y', POPT_ARG_STRING, 0, 'y', 0, 0},
233a236,237
> static char password_buffer[1024];
>
237a242,244
> FILE* file;
> struct stat stat_buf;
> int bytes_read;
266a274,291
> case 'y':
> if(lstat(arg, &stat_buf) == -1)
> {
> fprintf(stderr, "Failed to stat password file: %s\n", arg);
> usage(2, 1);
> }
>
> if(!(file = fopen(arg, "r")))
> {
> fprintf(stderr, "Failed to open password file: %s\n", arg);
> usage(2, 1);
> }
> bytes_read = fread(password_buffer, sizeof(char),
> sizeof(password_buffer) - sizeof(char), file);
> fclose(file);
> password_buffer[bytes_read] = '\0';
> result->bind_options.password = password_buffer;
> break;
More information about the ldapvi
mailing list