]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/controls.c
Remove lint
[openldap] / servers / slapd / controls.c
index f906b4068dcf04742fe3483de71517a55d705969..ec3712c31abbcedce439ce9f981317114bb4014b 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /* 
- * Copyright 1999 The OpenLDAP Foundation.
+ * Copyright 1999-2000 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
@@ -21,7 +21,6 @@
 
 char *supportedControls[] = {
        LDAP_CONTROL_MANAGEDSAIT,
-       LDAP_CONTROL_X_CHANGE_PASSWD,
        NULL
 };
 
@@ -49,17 +48,21 @@ int get_ctrls(
 
        if(( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) {
                if( tag == LBER_ERROR ) {
-                       rc = -1;
+                       rc = SLAPD_DISCONNECT;
                        errmsg = "unexpected data in PDU";
                }
 
                goto return_results;
        }
 
+#ifdef NEW_LOGGING
+       LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+                  "get_ctrls: conn %d\n", conn->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE, "=> get_ctrls\n", 0, 0, 0 );
-
+#endif
        if( op->o_protocol < LDAP_VERSION3 ) {
-               rc = -1;
+               rc = SLAPD_DISCONNECT;
                errmsg = "controls require LDAPv3";
                goto return_results;
        }
@@ -117,11 +120,17 @@ int get_ctrls(
                tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid );
 
                if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                       LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                  "get_ctrls: conn %d  get OID failed.\n",
+                                  conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n",
                                0, 0, 0 );
+#endif
                        *ctrls = NULL;
                        ldap_controls_free( tctrls );
-                       rc = -1;
+                       rc = SLAPD_DISCONNECT;
                        errmsg = "decoding controls error";
                        goto return_results;
                }
@@ -133,11 +142,17 @@ int get_ctrls(
                        tag = ber_scanf( ber, "b", &crit );
 
                        if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                          "get_ctrls: conn %d  get crit failed.\n",
+                                          conn->c_connid ));
+#else
                                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get crit failed.\n",
                                        0, 0, 0 );
+#endif
                                *ctrls = NULL;
                                ldap_controls_free( tctrls );
-                               rc = -1;
+                               rc = SLAPD_DISCONNECT;
                                errmsg = "decoding controls error";
                                goto return_results;
                        }
@@ -146,20 +161,31 @@ int get_ctrls(
                        tag = ber_peek_tag( ber, &len );
                }
 
+#ifdef NEW_LOGGING
+               LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                          "get_ctrls: conn %d oid=\"%s\" (%scritical)\n",
+                          conn->c_connid, tctrl->ldctl_oid,
+                          tctrl->ldctl_iscritical ? "" : "non" ));
+#else
                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n",
                        tctrl->ldctl_oid, 
                        tctrl->ldctl_iscritical ? "" : "non",
                        0 );
-
+#endif
                if( tag == LBER_OCTETSTRING ) {
                        tag = ber_scanf( ber, "o", &tctrl->ldctl_value );
 
                        if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                          "get_ctrls: conn %d  get value failed.\n", conn->c_connid ));
+#else
                                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get value failed.\n",
                                        0, 0, 0 );
+#endif
                                *ctrls = NULL;
                                ldap_controls_free( tctrls );
-                               rc = -1;
+                               rc = SLAPD_DISCONNECT;
                                errmsg = "decoding controls error";
                                goto return_results;
                        }
@@ -177,12 +203,18 @@ int get_ctrls(
        }
 
 return_results:
+#ifdef NEW_LOGGING
+       LDAP_LOG(( "operation", LDAP_LEVEL_RESULTS,
+                  "get_ctrls: conn %d  %d %d %s\n",
+                  conn->c_connid, nctrls, rc, errmsg ? errmsg : "" ));
+#else
        Debug( LDAP_DEBUG_TRACE, "<= get_ctrls: %d %d %s\n",
                nctrls, rc, errmsg ? errmsg : "");
+#endif
 
        if( sendres && rc != LDAP_SUCCESS ) {
-               if( rc == -1 ) {
-                       send_ldap_disconnect( conn, op, rc, errmsg );
+               if( rc == SLAPD_DISCONNECT ) {
+                       send_ldap_disconnect( conn, op, LDAP_PROTOCOL_ERROR, errmsg );
                } else {
                        send_ldap_result( conn, op, rc,
                                NULL, errmsg, NULL, NULL );