Diff for /libraries/libldap/sasl.c between versions 1.10 and 1.11

version 1.10, 2000/02/01 22:34:16 version 1.11, 2000/03/14 01:54:08
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/libraries/libldap/sasl.c,v 1.9 2000/01/16 00:29:15 lukeh Exp $ */  /* $OpenLDAP: pkg/ldap/libraries/libldap/sasl.c,v 1.10 2000/02/01 22:34:16 lukeh Exp $ */
 /*  /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.   * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Line 190  ldap_sasl_bind_s( Line 190  ldap_sasl_bind_s(
                 rc = ldap_parse_sasl_bind_result( ld, result, &scredp, 0 );                  rc = ldap_parse_sasl_bind_result( ld, result, &scredp, 0 );
         }          }
   
         if( rc != LDAP_SUCCESS ) {          if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) {
                 ldap_msgfree( result );                  ldap_msgfree( result );
                 return( rc );                  return( rc );
         }          }
   
         rc = ldap_result2error( ld, result, 1 );          rc = ldap_result2error( ld, result, 1 );
   
         if( rc == LDAP_SUCCESS ) {          if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) {
                 if( servercredp != NULL ) {                  if( servercredp != NULL ) {
                         *servercredp = scredp;                          *servercredp = scredp;
                 }                  }
Line 782  ldap_pvt_sasl_getsimple(void *context, i Line 782  ldap_pvt_sasl_getsimple(void *context, i
 }  }
   
 /*  /*
  * ldap_negotiated_sasl_bind_s - bind to the ldap server (and X.500) using SASL   * ldap_negotiated_sasl_bind_s - bind to the ldap server (and X.500)
  * authentication.  The dn and password of the entry to which to bind are   * using SASL authentication.
  * supplied.  LDAP_SUCCESS is returned upon success, the ldap error code   *
    * This routine attempts to authenticate the user referred by the
    * authentication id using the provided password.  An optional
    * authorization identity may be provided.  An DN is generally not
    * provided [see AuthMethod].
    *
    * If the mechanism negotiated does not require a password, the
    * passwd field is ignored.  [A callback mechanism should really
    * be used].
    * 
    * LDAP_SUCCESS is returned upon success, the ldap error code
  * otherwise.   * otherwise.
  *   *
  * Example:   * Examples:
    *      ldap_negotiated_sasl_bind_s( ld, NULL,
    *          "user@OPENLDAP.ORG", NULL, NULL,
    *              "GSSAPI", NULL, NULL, NULL );
    *
    *      ldap_negotiated_sasl_bind_s( ld, NULL,
    *          "manager", "cn=user,dc=openldap,dc=org", NULL,
    *              "DIGEST-MD5", NULL, NULL, NULL );
    *
  *      ldap_negotiated_sasl_bind_s( ld, NULL,   *      ldap_negotiated_sasl_bind_s( ld, NULL,
  *          "dn:cn=manager", NULL, "GSSAPI", NULL, NULL, NULL );   *          "root@OPENLDAP.ORG", "u:user@OPENLDAP.ORG", NULL,
    *              "GSSAPI", NULL, NULL, NULL );
    *
    *      ldap_negotiated_sasl_bind_s( ld, NULL,
    *          "manager", "dn:cn=user,dc=openldap,dc=org", NULL,
    *              "DIGEST-MD5", NULL, NULL, NULL );
  */   */
 int  int
 ldap_negotiated_sasl_bind_s(  ldap_negotiated_sasl_bind_s(
         LDAP *ld,          LDAP *ld,
         LDAP_CONST char *dn, /* usually NULL */          LDAP_CONST char *dn, /* usually NULL */
         LDAP_CONST char *authorizationId,          LDAP_CONST char *authenticationId,
         LDAP_CONST char *authenticationId,            LDAP_CONST char *authorizationId, /* commonly NULL */
         LDAP_CONST char *saslMechanism,               LDAP_CONST char *saslMechanism,
         struct berval *passPhrase,                  struct berval *passPhrase,
         LDAPControl **serverControls,          LDAPControl **serverControls,
         LDAPControl **clientControls)          LDAPControl **clientControls)
 {  {
         sasl_callback_t callbacks[4];          sasl_callback_t callbacks[4];
         int rc;          int rc;
   
         callbacks[0].id = SASL_CB_USER;          callbacks[0].id = SASL_CB_USER;
         callbacks[0].proc = ldap_pvt_sasl_getsimple;          callbacks[0].proc = ldap_pvt_sasl_getsimple;
         callbacks[0].context = (void *)authorizationId;          callbacks[1].context = (void *)authenticationId;
         callbacks[1].id = SASL_CB_AUTHNAME;          callbacks[1].id = SASL_CB_AUTHNAME;
         callbacks[1].proc = ldap_pvt_sasl_getsimple;          callbacks[1].proc = ldap_pvt_sasl_getsimple;
         callbacks[1].context = (void *)authenticationId;          callbacks[0].context = (void *)authorizationId;
         callbacks[2].id = SASL_CB_PASS;          callbacks[2].id = SASL_CB_PASS;
         callbacks[2].proc = ldap_pvt_sasl_getsecret;          callbacks[2].proc = ldap_pvt_sasl_getsecret;
         callbacks[2].context = (void *)passPhrase;          callbacks[2].context = (void *)passPhrase;
Line 818  ldap_negotiated_sasl_bind_s( Line 841  ldap_negotiated_sasl_bind_s(
         callbacks[3].proc = NULL;          callbacks[3].proc = NULL;
         callbacks[3].context = NULL;          callbacks[3].context = NULL;
   
         rc = ldap_pvt_sasl_bind(ld, dn, saslMechanism, callbacks, serverControls, clientControls);          rc = ldap_pvt_sasl_bind(ld, dn, saslMechanism, callbacks,
                   serverControls, clientControls);
   
         return rc;          return rc;
 }  }

Removed from v.1.10  
changed lines
  Added in v.1.11


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org