Changeset 7c7f02c


Ignore:
Timestamp:
09/24/13 07:27:10 (10 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
0a435b9
Parents:
155b055
Message:

Add a better method of setting SH values, so that we can specify
the types of quotes used

Location:
src-qt4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/libpcbsd/utils/pcbsd-utils.h

    r1620346 r7c7f02c  
    131131   static bool setValPBIConf(QString key, QString val); 
    132132   static bool setValSHFile(QString, QString, QString); 
     133   static bool setValSHFile(QString, QString, QString, QString); 
    133134   static bool setValCSHFile(QString, QString, QString); 
    134135   static bool setValPCBSDConf(QString key, QString val); 
  • src-qt4/libpcbsd/utils/utils.cpp

    rc3ae393 r7c7f02c  
    145145     line = stream.readLine(); 
    146146     if ( line.indexOf(envVal + "=") == 0 ) { 
    147         // Strip any "" 
    148147        line.replace(envVal + "=", ""); 
    149148 
     149        // Remove the ' or " from variable 
     150        if ( line.indexOf("'") == 0 ) { 
     151           line = line.section("'", 1, 1); 
     152           line = line.section("'", 0, 0); 
     153        }  
    150154        if ( line.indexOf('"') == 0 ) { 
    151155           line = line.section('"', 1, 1); 
     
    183187} 
    184188 
    185  
    186189bool Utils::setValSHFile(QString envFile, QString envName, QString envVal) 
     190{ 
     191        return setValSHFile(envFile, envName, envVal, QString('"')); 
     192} 
     193 
     194bool Utils::setValSHFile(QString envFile, QString envName, QString envVal, QString quote) 
    187195{ 
    188196  QFile confFile(envFile); 
     
    199207     if ( line.indexOf(envName + "=") == 0 ) { 
    200208        if ( ! envVal.isEmpty() && ! added ) 
    201           shConf << envName + "=\"" + envVal + "\" ; export " + envName; 
     209          shConf << envName + "=" + quote + envVal + quote + " ; export " + envName; 
    202210        added = true; 
    203211     } else { 
     
    209217 
    210218  if (! added && ! envVal.isEmpty() ) 
    211     shConf << envName + "=\"" + envVal + "\" ; export " + envName; 
     219    shConf << envName + "=" + quote + envVal + quote + " ; export " + envName; 
    212220 
    213221  if ( confFile.open( QIODevice::WriteOnly ) ) { 
     
    278286        if ( val.isEmpty() ) 
    279287           return QString(); 
    280         return val.section(":", 3, 3).section("'", 1, 1); 
     288        return val.section(":", 3, 3); 
    281289} 
    282290 
     
    362370   setValCSHFile(QString("/etc/csh.cshrc"), QString("https_proxy"), val); 
    363371   setValCSHFile(QString("/etc/csh.cshrc"), QString("no_proxy"), "127.0.0.1,localhost"); 
    364    setValSHFile(QString("/etc/profile"), QString("HTTP_PROXY"), val); 
    365    setValSHFile(QString("/etc/profile"), QString("HTTPS_PROXY"), val); 
     372   setValSHFile(QString("/etc/profile"), QString("HTTP_PROXY"), val, "'"); 
     373   setValSHFile(QString("/etc/profile"), QString("HTTPS_PROXY"), val, "'"); 
    366374   setValSHFile(QString("/etc/profile"), QString("NO_PROXY"), "127.0.0.1,localhost"); 
    367    setValSHFile(QString("/etc/profile"), QString("http_proxy"), val); 
    368    setValSHFile(QString("/etc/profile"), QString("https_proxy"), val); 
     375   setValSHFile(QString("/etc/profile"), QString("http_proxy"), val, "'"); 
     376   setValSHFile(QString("/etc/profile"), QString("https_proxy"), val, "'"); 
    369377   setValSHFile(QString("/etc/profile"), QString("no_proxy"), "127.0.0.1,localhost"); 
    370378   return true; 
     
    373381bool Utils::setProxyAuth(QString val) { 
    374382   setValCSHFile(QString("/etc/csh.cshrc"), QString("HTTP_PROXY_AUTH"), val); 
    375    return setValSHFile(QString("/etc/profile"), QString("HTTP_PROXY_AUTH"), val); 
     383   return setValSHFile(QString("/etc/profile"), QString("HTTP_PROXY_AUTH"), val, "'"); 
    376384} 
    377385 
  • src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp

    rc3ae393 r7c7f02c  
    10391039                authLine="digest:*:"; 
    10401040          authLine += lineProxyUser->text() + ":"; 
    1041           authLine += "'" + lineProxyPass->text() + "'"; 
     1041          authLine += lineProxyPass->text(); 
    10421042          pcbsd::Utils::setProxyAuth(authLine); 
    10431043        } 
Note: See TracChangeset for help on using the changeset viewer.