Use the credential manager on windows

- If flag credman_flag is set use function getcred_x() instead
  of function getpass_x() to retrieve the password.
This commit is contained in:
e9hack 2024-11-29 16:56:01 +01:00
parent 2930f98e41
commit 587798aca1
2 changed files with 19 additions and 0 deletions

View file

@ -428,7 +428,15 @@ int main( int argc, char *argv[] ) {
/* If the usename is given, but password is not, prompt for it */
if( args_info.user_given && !args_info.pass_given ) {
char *cp;
#ifdef USE_WINCREDMAN
if (args_info.credman_flag) {
cp = getcred_x (args_info.proxy_arg, args_info.user_arg);
} else {
cp = getpass_x ("Enter local proxy password for user %s: ", args_info.user_arg);
}
#else
cp = getpass_x ("Enter local proxy password for user %s: ", args_info.user_arg);
#endif
if (cp != NULL && strlen (cp) > 0) {
args_info.pass_arg = strdup (cp);
args_info.pass_given = 1;
@ -438,7 +446,15 @@ int main( int argc, char *argv[] ) {
if( args_info.remuser_given && !args_info.rempass_given ) {
char *cp;
#ifdef USE_WINCREDMAN
if (args_info.credman_flag) {
cp = getcred_x (args_info.remproxy_arg, args_info.remuser_arg);
} else {
cp = getpass_x ("Enter remote proxy password for user %s: ", args_info.remuser_arg);
}
#else
cp = getpass_x ("Enter remote proxy password for user %s: ", args_info.remuser_arg);
#endif
if (cp != NULL && strlen (cp) > 0) {
args_info.rempass_arg = strdup (cp);
args_info.rempass_given = 1;

View file

@ -44,6 +44,9 @@ size_t strzcat(char *dst, char *format, ...);
int main( int argc, char *argv[] );
char * readpassphrase(const char *, char *, size_t, int);
char * getpass_x(const char *format, ...);
#ifdef USE_WINCREDMAN
char* getcred_x(const char*, const char*);
#endif
/* Globals */
extern int read_fd; /* The file descriptor to read from */