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

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdelibs/kdeprint/management
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-12-13 11:55:56
[Download RAW message or body]

CVS commit by waba: 

Don't add password to command line


  M +9 -15     smbview.cpp   1.7.2.2


--- kdelibs/kdeprint/management/smbview.cpp  #1.7.2.1:1.7.2.2
@@ -28,13 +28,4 @@
 #include <kdebug.h>
 
-QString smbPasswordString(const QString& login, const QString& password)
-{
-        QString s;
-        if (login.isEmpty()) s = "-N";
-        else if (password.isEmpty()) s = QString("-U %1").arg(login);
-        else s = QString("-U %1%%2").arg(login).arg(password);
-        return s;
-}
-
 //*********************************************************************************************
  
@@ -122,4 +113,8 @@ void SmbView::setOpen(QListViewItem *ite
         if (on && item->childCount() == 0)
         {
+                if (!m_login.isEmpty())
+                        m_proc->setEnvironment("USER", m_login);
+                if (!m_password.isEmpty())
+                        m_proc->setEnvironment("PASSWD", m_password);
                 if (item->depth() == 0)
                 { // opening group
@@ -127,6 +122,6 @@ void SmbView::setOpen(QListViewItem *ite
                         *m_proc << "nmblookup -M ";
                         *m_proc << KProcess::quote(item->text(0));
-                        *m_proc << " -S | grep '<20>' | sed -e 's/^[[:space:]]*//' \
                -e 's/[[:space:]]*<20>.*//' | xargs -iserv_name smbclient -L \
                'serv_name' -W ";
-                        *m_proc << KProcess::quote(item->text(0)) + " "+ \
KProcess::quote(smbPasswordString(m_login,m_password)); +                        \
*m_proc << " -S | grep '<20>' | sed -e 's/^[[:space:]]*//' -e \
's/[[:space:]]*<20>.*//' | xargs -iserv_name smbclient -N -L 'serv_name' -W "; +      \
*m_proc << KProcess::quote(item->text(0));  startProcess(ServerListing);
                 }
@@ -134,9 +129,8 @@ void SmbView::setOpen(QListViewItem *ite
                 { // opening server
                         m_current = item;
-                        *m_proc << "smbclient -L ";
-                        *m_proc << KProcess::quote(item->text(0));
-                        *m_proc << "-W";
+                        *m_proc << "smbclient -N -L ";
                         *m_proc << KProcess::quote(item->text(0));
-                        *m_proc << \
KProcess::quote(smbPasswordString(m_login,m_password)); +                        \
*m_proc << " -W "; +                        *m_proc << \
KProcess::quote(item->parent()->text(0));  startProcess(ShareListing);
                 }


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

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