[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdeprint/cups
From:       Michael Goffioul <goffioul () imec ! be>
Date:       2004-02-23 12:25:58
Message-ID: 20040223122558.DF0719953 () office ! kde ! org
[Download RAW message or body]

CVS commit by goffioul: 

Use global variable to store password string (bug #75411)
CCMAIL: 75411-done@bugs.kde.org


  M +12 -0     cupsdoprint.c   1.9


--- kdelibs/kdeprint/cups/cupsdoprint.c  #1.8:1.9
@@ -113,6 +113,11 @@ const char* getPasswordCB(const char* pr
                                         {
                                                 *c = '\0';
+                                                /* retrieve password sequence number */
                                                 pwd_asked = atoi( ++c );
+                                                /* update CUPS with current username */
                                                 cupsSetUser( _user );
+                                                /* copy password to a non temporary location */
+                                                strlcpy( passwd, _passwd, BUFSIZE2 );
+                                                _passwd = passwd;
                                         }
                                         else
@@ -126,4 +131,8 @@ const char* getPasswordCB(const char* pr
                 return NULL;
 
+        /* erase buffer containing unencrypted password, for security */
+        memset( buf, 0, 256 );
+
+        /* if OK, _passwd should point to global passwd variable, otherwise it should be NULL */
         return _passwd;
 }
@@ -236,4 +245,7 @@ int main(int argc, char* argv[])
         /* print files */
         jobID = cupsPrintFiles(printer, num_files, files, jobname, num_options, options);
+        /* erase unemcrypted password for security */
+        memset( passwd, 0, BUFSIZE2 );
+        /* check job creation status */
         if (jobID <= 0)
                 error(ippErrorString(cupsLastError()));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic