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

List:       kde-commits
Subject:    KDE/kdelibs/kioslave/http
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2010-04-25 16:33:46
Message-ID: 20100425163346.3F3A2AC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1118669 by adawit:

- Added support for passing configuration info to the authentication object.

- Added a configuration option for enabling credentials delegation for GSSAPI \
(Negotiate)  authentication. To activate this featurei globally, simply add 

  "DelegateCredentialsOn=true" 

  to the global section of either $KDEHOME/share/config/kio_httprc or \
$KDEHOME/share/config/kioslaverc   files. To activate it per host/domain, first \
create a config group in either one of the two files   mentioned and then add the \
option. For example,

  [foo.bar]
  "DelegateCredentialsOn=true"

  That way the flag can be enabled only as needed.

BUG: 138414


 M  +1 -1      http.cpp  
 M  +11 -6     httpauthentication.cpp  
 M  +14 -10    httpauthentication.h  


--- trunk/KDE/kdelibs/kioslave/http/http.cpp #1118668:1118669
@@ -3225,7 +3225,7 @@
             }
 
             if (!(*auth)) {
-                *auth = KAbstractHttpAuthentication::newAuth(bestOffer);
+                *auth = KAbstractHttpAuthentication::newAuth(bestOffer, config());
             }            
             kDebug(7113) << "pointer to auth class is now" << *auth;
 
--- trunk/KDE/kdelibs/kioslave/http/httpauthentication.cpp #1118668:1118669
@@ -140,20 +140,20 @@
 }
 
 
-KAbstractHttpAuthentication *KAbstractHttpAuthentication::newAuth(const QByteArray \
&offer) +KAbstractHttpAuthentication *KAbstractHttpAuthentication::newAuth(const \
QByteArray &offer, KConfigGroup* config)  {
     QByteArray scheme = offer.mid(0, 10).toLower();
 #ifdef HAVE_LIBGSSAPI
     if (scheme.startsWith("negotiate")) { // krazy:exclude=strings
-        return new KHttpNegotiateAuthentication();
+        return new KHttpNegotiateAuthentication(config);
     } else
 #endif
     if (scheme.startsWith("digest")) { // krazy:exclude=strings
-        return new KHttpDigestAuthentication();
+        return new KHttpDigestAuthentication(config);
     } else if (scheme.startsWith("ntlm")) { // krazy:exclude=strings
-        return new KHttpNtlmAuthentication();
+        return new KHttpNtlmAuthentication(config);
     } else if (scheme.startsWith("basic")) { // krazy:exclude=strings
-        return new KHttpBasicAuthentication();
+        return new KHttpBasicAuthentication(config);
     }
     return 0;
 }
@@ -698,7 +698,12 @@
         return;
     }
 
-    OM_uint32 req_flags = 0;
+    OM_uint32 req_flags;
+    if (m_config && m_config->readEntry("DelegateCredentialsOn", false))
+       req_flags = GSS_C_DELEG_FLAG;
+    else
+       req_flags = 0;
+
     // GSSAPI knows how to get the credentials its own way, so don't ask for any
     major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
                                         &ctx, server, mech_oid,
--- trunk/KDE/kdelibs/kioslave/http/httpauthentication.h #1118668:1118669
@@ -33,16 +33,19 @@
 class AuthInfo;
 }
 
+class KConfigGroup;
+
 class KAbstractHttpAuthentication
 {
 public:
-    KAbstractHttpAuthentication()
+    KAbstractHttpAuthentication(KConfigGroup *config = 0)
+    : m_config(config)
     {
         reset();
     }
 
     static QByteArray bestOffer(const QList<QByteArray> &offers);
-    static KAbstractHttpAuthentication *newAuth(const QByteArray &offer);
+    static KAbstractHttpAuthentication *newAuth(const QByteArray &offer, \
KConfigGroup *config = 0);  
     virtual ~KAbstractHttpAuthentication() {}
 
@@ -81,6 +84,7 @@
     void authInfoBoilerplate(KIO::AuthInfo *a) const;
     void generateResponseCommon(const QString &user, const QString &password);
 
+    KConfigGroup *m_config;
     QByteArray m_scheme;    // this is parsed from the header and not necessarily == \
scheme().  QList<QByteArray> m_challenge;
     KUrl m_resource;
@@ -105,8 +109,8 @@
     virtual void generateResponse(const QString &user, const QString &password);
 private:
     friend class KAbstractHttpAuthentication;
-    KHttpBasicAuthentication()
-     : KAbstractHttpAuthentication() {}
+    KHttpBasicAuthentication(KConfigGroup *config = 0)
+     : KAbstractHttpAuthentication(config) {}
 };
 
 
@@ -119,8 +123,8 @@
     virtual void generateResponse(const QString &user, const QString &password);
 private:
     friend class KAbstractHttpAuthentication;
-    KHttpDigestAuthentication()
-     : KAbstractHttpAuthentication() {}
+    KHttpDigestAuthentication(KConfigGroup *config = 0)
+     : KAbstractHttpAuthentication(config) {}
 };
 
 
@@ -133,8 +137,8 @@
     virtual void generateResponse(const QString &user, const QString &password);
 private:
     friend class KAbstractHttpAuthentication;
-    KHttpNtlmAuthentication()
-     : KAbstractHttpAuthentication() {}
+    KHttpNtlmAuthentication(KConfigGroup *config = 0)
+     : KAbstractHttpAuthentication(config) {}
 };
 
 
@@ -148,8 +152,8 @@
     virtual void generateResponse(const QString &user, const QString &password);
 private:
     friend class KAbstractHttpAuthentication;
-    KHttpNegotiateAuthentication()
-     : KAbstractHttpAuthentication() {}
+    KHttpNegotiateAuthentication(KConfigGroup *config = 0)
+     : KAbstractHttpAuthentication(config) {}
 };
 #endif // HAVE_LIBGSSAPI
 


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

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