[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.19, 1.20 sasl_io.c, 1.8, 1.9

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Fri Nov 10 01:47:01 UTC 2006


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13201/ldap/servers/slapd

Modified Files:
	saslbind.c sasl_io.c 
Log Message:
Resolves: #214728
Summary: Cleaning up obsolete macros in the build
Changes: eliminated macro CYRUS_SASL and BUILD_GSSAPI (Comment #23)



Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- saslbind.c	7 Nov 2006 04:42:55 -0000	1.19
+++ saslbind.c	10 Nov 2006 01:46:59 -0000	1.20
@@ -36,24 +36,14 @@
  * All rights reserved.
  * END COPYRIGHT BLOCK **/
 
-#define CYRUS_SASL 1
-
 #include <slap.h>
 #include <fe.h>
 #include <sasl.h>
 #include <saslplug.h>
-#ifndef CYRUS_SASL
-#include <saslmod.h>
-#endif
 #ifndef _WIN32
 #include <unistd.h>
 #endif
 
-/* No GSSAPI on Windows */
-#if !defined(_WIN32)
-#define BUILD_GSSAPI 1
-#endif
-
 static char *serverfqdn;
 
 /*
@@ -427,14 +417,8 @@
     sasl_conn_t *conn,
     void *context,
     const char *userbuf, unsigned ulen,
-#ifndef CYRUS_SASL
-    const char *authidbuf, unsigned alen,
-#endif
     unsigned flags, const char *user_realm,
     char *out_user, unsigned out_umax, unsigned *out_ulen
-#ifndef CYRUS_SASL
-    ,char *out_authid, unsigned out_amax, unsigned *out_alen
-#endif
 )
 {
     struct propctx *propctx = sasl_auxprop_getctx(conn);
@@ -442,9 +426,6 @@
     Slapi_DN *sdn = NULL;
     char *pw = NULL;
     char *user = NULL;
-#ifndef CYRUS_SASL
-    char *authid = NULL;
-#endif
     const char *dn;
     int isroot = 0;
     char *clear = NULL;
@@ -454,17 +435,9 @@
     if (user == NULL) {
         goto fail;
     } 
-#ifdef CYRUS_SASL
     LDAPDebug(LDAP_DEBUG_TRACE, 
               "ids_sasl_canon_user(user=%s, realm=%s)\n", 
               user, user_realm ? user_realm : "", 0);
-#else
-    authid = buf2str(authidbuf, alen);
-
-    LDAPDebug(LDAP_DEBUG_TRACE, 
-              "ids_sasl_canon_user(user=%s, authzid=%s, realm=%s)\n", 
-              user, authid, user_realm ? user_realm : "");
-#endif
 
     if (strncasecmp(user, "dn:", 3) == 0) {
         sdn = slapi_sdn_new();
@@ -480,11 +453,9 @@
         /* map the sasl username into an entry */
         entry = ids_sasl_user_to_entry(conn, context, user, user_realm);
         if (entry == NULL) {
-#ifdef CYRUS_SASL
             /* Specific return value is supposed to be set instead of 
                an generic error (SASL_FAIL) for Cyrus SASL */
             returnvalue = SASL_NOAUTHZ;
-#endif
             goto fail;
         }
         dn = slapi_entry_get_ndn(entry);
@@ -515,22 +486,8 @@
 
     /* TODO: canonicalize */
     PL_strncpyz(out_user, dn, out_umax);
-#ifdef CYRUS_SASL
     /* the length of out_user needs to be set for Cyrus SASL */
     *out_ulen = strlen(out_user);
-#else
-    if (authid )
-    {
-        int offset = 0;
-        /* The authid can start with dn:. In such case remove it */    
-        if (strncasecmp(authid,"dn:",3) == 0 )
-            offset = 3;
-        PL_strncpyz(out_authid, authid+offset, out_amax);
-    }
-    *out_ulen = -1;
-    *out_alen = -1;
-    slapi_ch_free((void**)&authid);
-#endif
 
     slapi_entry_free(entry);
     slapi_ch_free((void**)&user);
@@ -542,16 +499,12 @@
  fail:
     slapi_entry_free(entry);
     slapi_ch_free((void**)&user);
-#ifndef CYRUS_SASL
-    slapi_ch_free((void**)&authid);
-#endif
     slapi_ch_free((void**)&pw);
     slapi_sdn_free(&sdn);
 
     return returnvalue;
 }
 
-#ifdef CYRUS_SASL
 static int ids_sasl_getpluginpath(sasl_conn_t *conn, const char **path)
 {
     /* Try to get path from config, otherwise check for SASL_PATH environment
@@ -566,7 +519,6 @@
     *path = pluginpath;
     return SASL_OK;
 }
-#endif
 
 static sasl_callback_t ids_sasl_callbacks[] =
 {
@@ -586,21 +538,15 @@
       NULL
     },
     {
-#ifdef CYRUS_SASL
       SASL_CB_CANON_USER,
-#else
-      SASL_CB_SERVER_CANON_USER,
-#endif
       (IFP) ids_sasl_canon_user,
       NULL
     },
-#ifdef CYRUS_SASL
     {
       SASL_CB_GETPATH,
       (IFP) ids_sasl_getpluginpath,
       NULL
     },
-#endif
     {
       SASL_CB_LIST_END,
       (IFP) NULL,
@@ -636,25 +582,6 @@
         return result;
     }
 
-#ifndef CYRUS_SASL
-    result = sasl_server_add_plugin("USERDB", sasl_userdb_init);
-
-    if (result != SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "failed to add LDAP sasl plugin\n",
-                  0, 0, 0);
-        return result;
-    }
-
-#if defined(BUILD_GSSAPI)
-    result = sasl_server_add_plugin("GSSAPI", sasl_gssapi_init);
-
-    if (result != SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "failed to add LDAP gssapi plugin\n",
-                  0, 0, 0);
-    }
-#endif
-#endif
-
     result = sasl_auxprop_add_plugin("iDS", ids_auxprop_plug_init);
 
     LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_init\n", 0, 0, 0 );


Index: sasl_io.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/sasl_io.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- sasl_io.c	26 Sep 2006 22:08:17 -0000	1.8
+++ sasl_io.c	10 Nov 2006 01:46:59 -0000	1.9
@@ -35,8 +35,6 @@
  * All rights reserved.
  * END COPYRIGHT BLOCK **/
 
-#define CYRUS_SASL 1
-
 #include "slap.h"
 #include "slapi-plugin.h"
 #include "fe.h"
@@ -201,7 +199,6 @@
         return -1;
         
     }
-#ifdef CYRUS_SASL
     if (ret == sizeof(buffer)) {
         /* Decode the length (could use ntohl here ??) */
         packet_length = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
@@ -217,17 +214,6 @@
         c->c_sasl_io_private->encrypted_buffer_count = packet_length;
         c->c_sasl_io_private->encrypted_buffer_offset = 4;
     }
-#else
-    if (ret == sizeof(buffer)) {
-        /* Decode the length (could use ntohl here ??) */
-        packet_length = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
-        LDAPDebug( LDAP_DEBUG_CONNS,
-            "read sasl packet length %ld on connection %d\n", packet_length, c->c_connid, 0 );
-        sasl_io_resize_encrypted_buffer(c->c_sasl_io_private, packet_length);
-        c->c_sasl_io_private->encrypted_buffer_count = packet_length;
-        c->c_sasl_io_private->encrypted_buffer_offset = 0;
-    }
-#endif
     return 0;
 }
 static int




More information about the Fedora-directory-commits mailing list