]> git.sur5r.net Git - openldap/commitdiff
Update result code to IANA-assigned values
authorKurt Zeilenga <kurt@openldap.org>
Thu, 3 Nov 2005 01:27:07 +0000 (01:27 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 3 Nov 2005 01:27:07 +0000 (01:27 +0000)
Provide some backwards compatibility.
Misc cleanup

include/ldap.h
libraries/libldap/error.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-ldap/chain.c
servers/slapd/backglue.c
servers/slapd/mods.c
servers/slapd/overlays/syncprov.c
servers/slapd/syncrepl.c

index b2ccc1038a3961649cf81607ad63cf64428aaf76..7cfba13cf083369f5022aa108731458b08126b8f 100644 (file)
@@ -208,10 +208,10 @@ typedef struct ldapcontrol {
 #define LDAP_CONTROL_PROXY_AUTHZ       "2.16.840.1.113730.3.4.18" /* RFC TBD  */
 #define LDAP_CONTROL_SUBENTRIES                "1.3.6.1.4.1.4203.1.10.1"  /* RFC 3672 */
 
-#define LDAP_CONTROL_VALUESRETURNFILTER        "1.2.826.0.1.334810.2.3" /*RFC 3876*/
-#define LDAP_CONTROL_ASSERT                            "1.3.6.1.1.12"
-#define LDAP_CONTROL_PRE_READ                  "1.3.6.1.1.13.1"
-#define LDAP_CONTROL_POST_READ                 "1.3.6.1.1.13.2"
+#define LDAP_CONTROL_VALUESRETURNFILTER        "1.2.826.0.1.334810.2.3"/* RFC 3876 */
+#define LDAP_CONTROL_ASSERT                            "1.3.6.1.1.12"                  /* RFC TBD */
+#define LDAP_CONTROL_PRE_READ                  "1.3.6.1.1.13.1"                /* RFC TBD */
+#define LDAP_CONTROL_POST_READ                 "1.3.6.1.1.13.2"                /* RFC TBD */
 
 /*  standard track - not implemented in slapd(8) */
 #define LDAP_CONTROL_SORTREQUEST    "1.2.840.113556.1.4.473" /* RFC 2891 */
@@ -220,6 +220,11 @@ typedef struct ldapcontrol {
 /*     non-standard track controls */
 #define LDAP_CONTROL_PAGEDRESULTS      "1.2.840.113556.1.4.319"   /* RFC 2696 */
 
+/* Password policy Controls *//* work in progress */
+/* ITS#3458: released; disabled by default */
+#define LDAP_CONTROL_PASSWORDPOLICYREQUEST     "1.3.6.1.4.1.42.2.27.8.5.1"
+#define LDAP_CONTROL_PASSWORDPOLICYRESPONSE    "1.3.6.1.4.1.42.2.27.8.5.1"
+
 /* various works in progress */
 #define LDAP_CONTROL_NOOP                              "1.3.6.1.4.1.4203.666.5.2"
 #define LDAP_CONTROL_NO_SUBORDINATES   "1.3.6.1.4.1.4203.666.5.11"
@@ -227,30 +232,6 @@ typedef struct ldapcontrol {
 #define LDAP_CONTROL_SLURP                             "1.3.6.1.4.1.4203.666.5.13"
 #define LDAP_CONTROL_VALSORT                   "1.3.6.1.4.1.4203.666.5.14"
 
-/* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */
-#define LDAP_CONTROL_DUPENT_REQUEST            "2.16.840.1.113719.1.27.101.1"
-#define LDAP_CONTROL_DUPENT_RESPONSE   "2.16.840.1.113719.1.27.101.2"
-#define LDAP_CONTROL_DUPENT_ENTRY              "2.16.840.1.113719.1.27.101.3"
-#define LDAP_CONTROL_DUPENT    LDAP_CONTROL_DUPENT_REQUEST
-
-/* LDAP Persistent Search Control *//* not implemented in slapd(8) */
-/* draft-ietf-ldapext-psearch-03.txt (expired) */
-#define LDAP_CONTROL_PERSIST_REQUEST                           "2.16.840.1.113730.3.4.3"
-#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE       "2.16.840.1.113730.3.4.7"
-#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_ADD          0x1
-#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_DELETE       0x2
-#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_MODIFY       0x4
-#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_RENAME       0x8
-
-/* LDAP VLV *//* not implemented in slapd(8) */
-#define LDAP_CONTROL_VLVREQUEST        "2.16.840.1.113730.3.4.9"
-#define LDAP_CONTROL_VLVRESPONSE    "2.16.840.1.113730.3.4.10"
-
-/* Password policy Controls *//* work in progress */
-/* ITS#3458: released; disabled by default */
-#define LDAP_CONTROL_PASSWORDPOLICYREQUEST     "1.3.6.1.4.1.42.2.27.8.5.1"
-#define LDAP_CONTROL_PASSWORDPOLICYRESPONSE    "1.3.6.1.4.1.42.2.27.8.5.1"
-
 /* LDAP Sync -- draft-zeilenga-ldup-sync *//* submitted for publication */
 #define LDAP_SYNC_OID                  "1.3.6.1.4.1.4203.1.9.1"
 #define LDAP_CONTROL_SYNC              LDAP_SYNC_OID ".1"
@@ -305,6 +286,26 @@ typedef struct ldapcontrol {
 #define LDAP_CONTROL_X_TREE_DELETE             "1.2.840.113556.1.4.805"
 #define LDAP_CONTROL_X_EXTENDED_DN             "1.2.840.113556.1.4.529"
 
+/* various expired works */
+/* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */
+#define LDAP_CONTROL_DUPENT_REQUEST            "2.16.840.1.113719.1.27.101.1"
+#define LDAP_CONTROL_DUPENT_RESPONSE   "2.16.840.1.113719.1.27.101.2"
+#define LDAP_CONTROL_DUPENT_ENTRY              "2.16.840.1.113719.1.27.101.3"
+#define LDAP_CONTROL_DUPENT    LDAP_CONTROL_DUPENT_REQUEST
+
+/* LDAP Persistent Search Control *//* not implemented in slapd(8) */
+#define LDAP_CONTROL_PERSIST_REQUEST                           "2.16.840.1.113730.3.4.3"
+#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE       "2.16.840.1.113730.3.4.7"
+#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_ADD          0x1
+#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_DELETE       0x2
+#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_MODIFY       0x4
+#define LDAP_CONTROL_PERSSIT_ENTRY_CHANGE_RENAME       0x8
+
+/* LDAP VLV *//* not implemented in slapd(8) */
+#define LDAP_CONTROL_VLVREQUEST        "2.16.840.1.113730.3.4.9"
+#define LDAP_CONTROL_VLVRESPONSE    "2.16.840.1.113730.3.4.10"
+
+
 /* LDAP Unsolicited Notifications */
 #define        LDAP_NOTICE_OF_DISCONNECTION    "1.3.6.1.4.1.1466.20036" /* RFC 2251 */
 #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION
@@ -322,7 +323,6 @@ typedef struct ldapcontrol {
 #define LDAP_EXOP_X_CANCEL             LDAP_EXOP_CANCEL
 
 /* various works in progress */
-
 #define LDAP_EXOP_WHO_AM_I             "1.3.6.1.4.1.4203.1.11.3"
 #define LDAP_EXOP_X_WHO_AM_I   LDAP_EXOP_WHO_AM_I
 
@@ -474,7 +474,6 @@ typedef struct ldapcontrol {
 #define LDAP_SUBSTRING_FINAL   ((ber_tag_t) 0x82U)     /* context specific */
 
 /* search scopes */
-#define LDAP_SCOPE_DEFAULT             ((ber_int_t) -1)         /* OpenLDAP extension */
 #define LDAP_SCOPE_BASE                        ((ber_int_t) 0x0000)
 #define LDAP_SCOPE_BASEOBJECT  LDAP_SCOPE_BASE
 #define LDAP_SCOPE_ONELEVEL            ((ber_int_t) 0x0001)
@@ -483,6 +482,7 @@ typedef struct ldapcontrol {
 #define LDAP_SCOPE_SUB                 LDAP_SCOPE_SUBTREE
 #define LDAP_SCOPE_SUBORDINATE ((ber_int_t) 0x0003) /* OpenLDAP extension */
 #define LDAP_SCOPE_CHILDREN            LDAP_SCOPE_SUBORDINATE
+#define LDAP_SCOPE_DEFAULT             ((ber_int_t) -1)         /* OpenLDAP extension */
 
 /* substring filter component types */
 #define LDAP_SUBSTRING_INITIAL ((ber_tag_t) 0x80U)     /* context specific */
@@ -554,7 +554,7 @@ typedef struct ldapcontrol {
 #define LDAP_ALREADY_EXISTS                    0x44
 #define LDAP_NO_OBJECT_CLASS_MODS      0x45
 #define LDAP_RESULTS_TOO_LARGE         0x46 /* CLDAP */
-#define LDAP_AFFECTS_MULTIPLE_DSAS     0x47 /* LDAPv3 */
+#define LDAP_AFFECTS_MULTIPLE_DSAS     0x47
 
 #define LDAP_OTHER                                     0x50
 
@@ -571,27 +571,34 @@ typedef struct ldapcontrol {
 #define LDAP_TOO_LATE                          0x78
 #define LDAP_CANNOT_CANCEL                     0x79
 
+/* Assertion control (122) */ 
+#define LDAP_ASSERTION_FAILED          0x7A
+
 
 /* Experimental result codes */
-#define LDAP_E_ERROR(n)        LDAP_RANGE((n),0x1000,0x3FFF) /* experimental */
-#define LDAP_X_ERROR(n)        LDAP_RANGE((n),0x4000,0xFFFF) /* private use */
+#define LDAP_E_ERROR(n)        LDAP_RANGE((n),0x1000,0x3FFF)
 
-/* for the LDAP Sync operation */
-#define LDAP_SYNC_REFRESH_REQUIRED             0x4100
+/* LDAP Sync (4096) */
+#define LDAP_SYNC_REFRESH_REQUIRED             0x1000
 
-/* for the LDAP No-Op control */
-#define LDAP_NO_OPERATION                              0x410e
 
-/* for the Assertion control */
-#define LDAP_ASSERTION_FAILED                  0x410f
+/* Private Use result codes */
+#define LDAP_X_ERROR(n)        LDAP_RANGE((n),0x4000,0xFFFF)
+
+#define LDAP_X_SYNC_REFRESH_REQUIRED   0x4100 /* defunct */
+#define LDAP_X_ASSERTION_FAILED                        0x410f /* defunct */
+
+/* for the LDAP No-Op control */
+#define LDAP_X_NO_OPERATION                            0x410e
 
 /* for the Chaining Behavior control (consecutive result codes requested;
  * see <draft-sermersheim-ldap-chaining> ) */
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
-#define        LDAP_NO_REFERRALS_FOUND                 0x4110
-#define LDAP_CANNOT_CHAIN                      0x4111
+#define        LDAP_X_NO_REFERRALS_FOUND               0x4110
+#define LDAP_X_CANNOT_CHAIN                            0x4111
 #endif
 
+
 /* API Error Codes
  *
  * Based on draft-ietf-ldap-c-api-xx
index db26ae97ce7d0f0c8e7b4ba6f4d7c9552d5994e8..529a3e2eeabd23a75ee02ec9f4fa241471678af8 100644 (file)
@@ -85,6 +85,19 @@ static struct ldaperror ldap_builtin_errlist[] = {
 
        {LDAP_OTHER,                                    N_("Internal (implementation specific) error")},
 
+       {LDAP_CANCELLED,                                N_("Cancelled")},
+       {LDAP_NO_SUCH_OPERATION,                N_("No Operation to Cancel")},
+       {LDAP_TOO_LATE,                                 N_("Too Late to Cancel")},
+       {LDAP_CANNOT_CANCEL,                    N_("Cannot Cancel")},
+
+       {LDAP_ASSERTION_FAILED,                 N_("Assertion Failed")},
+       {LDAP_X_ASSERTION_FAILED,               N_("Assertion Failed (X)")},
+
+       {LDAP_SYNC_REFRESH_REQUIRED,    N_("Content Sync Refresh Required")},
+       {LDAP_X_SYNC_REFRESH_REQUIRED,  N_("Content Sync Refresh Required (X)")},
+
+       {LDAP_X_NO_OPERATION,                   N_("No Operation (X)")},
+
        /* API ResultCodes */
        {LDAP_SERVER_DOWN,                              N_("Can't contact LDAP server")},
        {LDAP_LOCAL_ERROR,                              N_("Local error")},
@@ -105,22 +118,12 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_CLIENT_LOOP,                              N_("Client Loop")},
        {LDAP_REFERRAL_LIMIT_EXCEEDED,  N_("Referral Limit Exceeded")},
 
-       {LDAP_SYNC_REFRESH_REQUIRED,    N_("Content Sync Refresh Required")},
-
-       {LDAP_NO_OPERATION,                             N_("No Operation")},
-       {LDAP_ASSERTION_FAILED,                 N_("Assertion Failed")},
-
        {LDAP_CUP_RESOURCES_EXHAUSTED,  N_("LCUP Resources Exhausted")},
        {LDAP_CUP_SECURITY_VIOLATION,   N_("LCUP Security Violation")},
        {LDAP_CUP_INVALID_DATA,                 N_("LCUP Invalid Data")},
        {LDAP_CUP_UNSUPPORTED_SCHEME,   N_("LCUP Unsupported Scheme")},
        {LDAP_CUP_RELOAD_REQUIRED,              N_("LCUP Reload Required")},
 
-       {LDAP_CANCELLED,                                N_("Cancelled")},
-       {LDAP_NO_SUCH_OPERATION,                N_("No Operation to Cancel")},
-       {LDAP_TOO_LATE,                                 N_("Too Late to Cancel")},
-       {LDAP_CANNOT_CANCEL,                    N_("Cannot Cancel")},
-
        {0, NULL}
 };
 
index f450f630bd6426602f9e39fb1a328bfb6c54d0d7..6cf4e58f1d2f3a855f17071f3c0cccf9456888c2 100644 (file)
@@ -377,7 +377,7 @@ retry:      /* transaction retry */
                if (( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
                        rs->sr_text = "txn_abort (no-op) failed";
                } else {
-                       rs->sr_err = LDAP_NO_OPERATION;
+                       rs->sr_err = LDAP_X_NO_OPERATION;
                        ltid = NULL;
                        goto return_results;
                }
index ad6f9eba1bafa611367e045525a7d77d3fff7805..a1bef6cccd343e35ffd38373300bc24af5a6468d 100644 (file)
@@ -446,7 +446,7 @@ retry:      /* transaction retry */
                if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
                        rs->sr_text = "txn_abort (no-op) failed";
                } else {
-                       rs->sr_err = LDAP_NO_OPERATION;
+                       rs->sr_err = LDAP_X_NO_OPERATION;
                        ltid = NULL;
                        goto return_results;
                }
index 908da30cc69f4286850972f35eaa8fcbba383ad7..08d0a5d8c7c114b798c751dbc4a9e56490f13f44 100644 (file)
@@ -527,7 +527,7 @@ retry:      /* transaction retry */
                if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
                        rs->sr_text = "txn_abort (no-op) failed";
                } else {
-                       rs->sr_err = LDAP_NO_OPERATION;
+                       rs->sr_err = LDAP_X_NO_OPERATION;
                        ltid = NULL;
                        goto return_results;
                }
index cef5c72a6913644f0d25319afd740c8f80c8931e..422420dcafc84e0c2d582fe274b073b1fff3bf9b 100644 (file)
@@ -728,7 +728,7 @@ retry:      /* transaction retry */
                if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
                        rs->sr_text = "txn_abort (no-op) failed";
                } else {
-                       rs->sr_err = LDAP_NO_OPERATION;
+                       rs->sr_err = LDAP_X_NO_OPERATION;
                        ltid = NULL;
                        goto return_results;
                }
index 2cba84c833adb8002556bd4ebf184bf32dcebb93..8f702c85b9d18882ef57ad434631d54e667d2f17 100644 (file)
@@ -576,7 +576,7 @@ ldap_chain_response( Operation *op, SlapReply *rs )
 
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
        if ( rc != LDAP_SUCCESS || sc2.sc_private == LDAP_CH_ERR ) {
-               if ( rs->sr_err == LDAP_CANNOT_CHAIN ) {
+               if ( rs->sr_err == LDAP_X_CANNOT_CHAIN ) {
                        goto cannot_chain;
                }
 
@@ -584,7 +584,8 @@ ldap_chain_response( Operation *op, SlapReply *rs )
                case LDAP_CHAINING_REQUIRED:
 cannot_chain:;
                        op->o_callback = NULL;
-                       send_ldap_error( op, rs, LDAP_CANNOT_CHAIN, "operation cannot be completed without chaining" );
+                       send_ldap_error( op, rs, LDAP_X_CANNOT_CHAIN,
+                               "operation cannot be completed without chaining" );
                        break;
 
                default:
index bc17618b36bf29a0f08acab01865199ae424380a..777a7272c5c8435c4d69054657c3eac54bdedd23 100644 (file)
@@ -369,7 +369,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
                        case LDAP_ADMINLIMIT_EXCEEDED:
                        case LDAP_NO_SUCH_OBJECT:
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
-                       case LDAP_CANNOT_CHAIN:
+                       case LDAP_X_CANNOT_CHAIN:
 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
                                goto end_of_loop;
                        
index a9a66074dae5a31c1480c36ef162c677913a0274..40945fd21fbc9c5ab5c39b752eba3c00cb243b18 100644 (file)
@@ -73,11 +73,15 @@ modify_add_values(
                }
 
                if ( permissive ) {
-                       for ( i = 0; !BER_BVISNULL( &mod->sm_values[i] ); i++ ) /* count 'em */;
-                       pmod.sm_values = (BerVarray)ch_malloc( (i + 1)*sizeof( struct berval ) );
+                       for ( i = 0; !BER_BVISNULL( &mod->sm_values[i] ); i++ ) {
+                               /* EMPTY -- just counting 'em */;
+                       }
+
+                       pmod.sm_values = (BerVarray)ch_malloc(
+                               (i + 1) * sizeof( struct berval ));
                        if ( pmod.sm_nvalues != NULL ) {
                                pmod.sm_nvalues = (BerVarray)ch_malloc(
-                                       (i + 1)*sizeof( struct berval ) );
+                                       (i + 1) * sizeof( struct berval ));
                        }
                }
 
index 74b2352e9b07012ac51cbcab49ac85d90cf222f3..561b5b2fd1cc21ab353d410d90f865cca9b500c1 100644 (file)
@@ -734,7 +734,8 @@ syncprov_free_syncop( syncops *so )
 
 /* Send a persistent search response */
 static int
-syncprov_sendresp( Operation *op, opcookie *opc, syncops *so, Entry **e, int mode)
+syncprov_sendresp( Operation *op, opcookie *opc, syncops *so,
+       Entry **e, int mode )
 {
        slap_overinst *on = opc->son;
 
index d49f0989417a7b137a5696bdfa7622d64c484a12..07653669606a097179085d05230db1d40627413f 100644 (file)
@@ -738,6 +738,12 @@ do_syncrep2(
                                        "do_syncrep2: LDAP_RES_SEARCH_RESULT\n", 0, 0, 0 );
                                ldap_parse_result( si->si_ld, msg, &err, NULL, NULL, NULL,
                                        &rctrls, 0 );
+#ifdef LDAP_X_SYNC_REFRESH_REQUIRED
+                               if ( err == LDAP_X_SYNC_REFRESH_REQUIRED ) {
+                                       /* map old result code to registered code */
+                                       err = LDAP_SYNC_REFRESH_REQUIRED;
+                               }
+#endif
                                if ( err == LDAP_SYNC_REFRESH_REQUIRED ) {
                                        if ( si->si_logstate == SYNCLOG_LOGGING ) {
                                                si->si_logstate = SYNCLOG_FALLBACK;