cURL / Mailing Lists / curl-library / Single Mail

curl-library

passwdgiven also used at proxy passwd

From: Joerg Mueller-Tolk <curl_at_mueller-tolk.de>
Date: Mon, 01 Sep 2003 19:07:38 +0200

Hi all

I just posted something for handling host passwords.
Now I realized that this could also be applied to where the proxy
password is handled. Daniel, what do you think?

diff -u url-org.c url.c
--- url-org.c Thu Aug 14 16:20:02 2003
+++ url.c Mon Sep 1 19:05:02 2003
@@ -2137,18 +2137,24 @@
    if(conn->bits.proxy_user_passwd) {
      char proxyuser[MAX_CURL_USER_LENGTH]="";
      char proxypasswd[MAX_CURL_PASSWORD_LENGTH]="";
+ passwdgiven = FALSE;

      if(*data->set.proxyuserpwd != ':') {
        /* the name is given, get user+password */
        sscanf(data->set.proxyuserpwd, "%127[^:]:%127[^\n]",
               proxyuser, proxypasswd);
+ if(strchr(data->set.proxyuserpwd, ':'))
+ /* a colon means the password was given, even if blank */
+ passwdgiven = TRUE;
        }
- else
+ else {
        /* no name given, get the password only */
        sscanf(data->set.proxyuserpwd+1, "%127[^\n]", proxypasswd);
+ passwdgiven = TRUE;
+ }

      /* check for password, if no ask for one */
- if( !proxypasswd[0] ) {
+ if( !proxypasswd[0] && !passwdgiven) {
        if(data->set.fpasswd( data->set.passwd_client,
                              "proxy password:",
                              proxypasswd,
@@ -2702,6 +2708,7 @@

    user[0] =0; /* to make everything well-defined */
    passwd[0]=0;
+ passwdgiven = FALSE;

    if (conn->protocol & (PROT_FTP|PROT_HTTP)) {
      /* This is a FTP or HTTP URL, we will now try to extract the possible

Joerg M-T

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-01