]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/controls.c
ITS#2846 - make veryclean
[openldap] / servers / slapd / controls.c
index 2a7806194ad1a6d02e9679900d1d3510626633d7..c5aca28721cfa925f4e76cdbbc3d7777dd14c86d 100644 (file)
@@ -1,13 +1,18 @@
 /* $OpenLDAP$ */
-/* 
- * Copyright 1999-2003 The OpenLDAP Foundation.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2003 The OpenLDAP Foundation.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted only
- * as authorized by the OpenLDAP Public License.  A copy of this
- * license is available at http://www.OpenLDAP.org/license.html or
- * in file LICENSE in the top-level directory of the distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
+
 #include "portable.h"
 
 #include <stdio.h>
@@ -73,13 +78,13 @@ static char *proxy_authz_extops[] = {
 
 static struct slap_control control_defs[] = {
        { LDAP_CONTROL_ASSERT,
-               SLAP_CTRL_ACCESS, NULL,
+               SLAP_CTRL_HIDE|SLAP_CTRL_ACCESS, NULL,
                parseAssert, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_PRE_READ,
-               SLAP_CTRL_DELETE|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
+               SLAP_CTRL_HIDE|SLAP_CTRL_DELETE|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
                parsePreRead, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_POST_READ,
-               SLAP_CTRL_ADD|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
+               SLAP_CTRL_HIDE|SLAP_CTRL_ADD|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME, NULL,
                parsePostRead, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_VALUESRETURNFILTER,
                SLAP_CTRL_SEARCH, NULL,
@@ -111,7 +116,7 @@ static struct slap_control control_defs[] = {
                SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL,
                parseLDAPsync, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_MODIFY_INCREMENT,
-               SLAP_CTRL_MODIFY, NULL,
+               SLAP_CTRL_HIDE|SLAP_CTRL_MODIFY, NULL,
                parseModifyIncrement, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_MANAGEDSAIT,
                SLAP_CTRL_ACCESS, NULL,
@@ -986,7 +991,7 @@ static int parsePreRead (
        }
 
        siz = sizeof( AttributeName );
-       off = 0;
+       off = offsetof( AttributeName, an_name );
        if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
                rs->sr_text = "preread control: decoding error";
                return LDAP_PROTOCOL_ERROR;
@@ -1035,7 +1040,7 @@ static int parsePostRead (
        }
 
        siz = sizeof( AttributeName );
-       off = 0;
+       off = offsetof( AttributeName, an_name );
        if ( ber_scanf( ber, "{M}", &an, &siz, off ) == LBER_ERROR ) {
                rs->sr_text = "postread control: decoding error";
                return LDAP_PROTOCOL_ERROR;
@@ -1206,7 +1211,7 @@ static int parseLDAPsync (
        BerElement *ber;
        ber_int_t mode;
        ber_len_t len;
-       struct berval cookie = { 0, NULL };
+       struct slap_session_entry *se;
 
        if ( op->o_sync != SLAP_NO_CONTROL ) {
                rs->sr_text = "LDAP Sync control specified multiple times";
@@ -1255,22 +1260,25 @@ static int parseLDAPsync (
 
        tag = ber_peek_tag( ber, &len );
 
-       if ( tag == LDAP_SYNC_TAG_COOKIE ) {
-               if (( ber_scanf( ber, /*{*/ "m}",
-                                       &cookie )) == LBER_ERROR ) {
+       if ( tag == LDAP_TAG_SYNC_COOKIE ) {
+               struct berval tmp_bv;   
+               if (( ber_scanf( ber, /*{*/ "o", &tmp_bv )) == LBER_ERROR ) {
                        rs->sr_text = "LDAP Sync control : cookie decoding error";
                        return LDAP_PROTOCOL_ERROR;
                }
-       } else {
-               if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
-                       rs->sr_text = "LDAP Sync control : decoding error";
+               ber_bvarray_add( &op->o_sync_state.octet_str, &tmp_bv );
+               slap_parse_sync_cookie( &op->o_sync_state );
+       }
+       if ( tag == LDAP_TAG_RELOAD_HINT ) {
+               if (( ber_scanf( ber, /*{*/ "b", &op->o_sync_rhint )) == LBER_ERROR ) {
+                       rs->sr_text = "LDAP Sync control : rhint decoding error";
                        return LDAP_PROTOCOL_ERROR;
                }
-               cookie.bv_len = 0;
-               cookie.bv_val = NULL;
        }
-
-       ber_dupbv( &op->o_sync_state, &cookie );
+       if (( ber_scanf( ber, /*{*/ "}")) == LBER_ERROR ) {
+                       rs->sr_text = "LDAP Sync control : decoding error";
+                       return LDAP_PROTOCOL_ERROR;
+       }
 
        (void) ber_free( ber, 1 );