[ldapvi] Patch for -y/--password-file cmdline argument

David Bartley dtbartle at csclub.uwaterloo.ca
Thu May 17 02:28:45 CEST 2007


I guess the lstat part isn't needed - revised patch.

On Wed, 16 May 2007, David Bartley wrote:

> 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;
>     int bytes_read;
266a274,291
>     case 'y':
>         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