]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/controls.c
Remove lint
[openldap] / servers / slapd / controls.c
index d0da95c2bb04a8ff1914038c7af0ddd048c91186..7c26ff1c38fb4876cf072298de6dfbda2dcc92e7 100644 (file)
@@ -90,7 +90,7 @@ static struct slap_control {
        { LDAP_CONTROL_CLIENT_UPDATE,
                SLAP_CTRL_SEARCH, NULL,
                parseClientUpdate },
-#endif
+#endif /* LDAP_CLIENT_UPDATE */
        { NULL }
 };
 
@@ -126,10 +126,6 @@ int get_ctrls(
        int rc = LDAP_SUCCESS;
        const char *errmsg = NULL;
 
-#ifdef LDAP_CLIENT_UPDATE
-       op->o_clientupdatetype = -1;
-#endif
-
        len = ber_pvt_ber_remaining(ber);
 
        if( len == 0) {
@@ -624,7 +620,7 @@ static int parseClientUpdate (
        struct berval scheme = { 0, NULL };
        struct berval cookie = { 0, NULL };
 
-       if ( op->o_noop != SLAP_NO_CONTROL ) {
+       if ( op->o_clientupdate != SLAP_NO_CONTROL ) {
                *text = "LCUP client update control specified multiple times";
                return LDAP_PROTOCOL_ERROR;
        }
@@ -656,9 +652,17 @@ static int parseClientUpdate (
                return LDAP_PROTOCOL_ERROR;
        }
 
-       if ( type != SYNCHRONIZE_ONLY &&
-            type != SYNCHRONIZE_AND_PERSIST &&
-            type != PERSIST_ONLY ) {
+       switch( type ) {
+       case LDAP_CUP_SYNC_ONLY:
+               type = SLAP_LCUP_SYNC;
+               break;
+       case LDAP_CUP_SYNC_AND_PERSIST:
+               type = SLAP_LCUP_SYNC_AND_PERSIST;
+               break;
+       case LDAP_CUP_PERSIST_ONLY:
+               type = SLAP_LCUP_PERSIST;
+               break;
+       default:
                *text = "LCUP client update control : unknown update type";
                return LDAP_PROTOCOL_ERROR;
        }
@@ -676,12 +680,12 @@ static int parseClientUpdate (
                
                if ( interval <= 0 ) {
                        /* server chooses interval */
-                       interval = LDAP_LCUP_DEFAULT_SEND_COOKIE_INTERVAL;
+                       interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
                }
-       }
-       else {
+
+       else {
                /* server chooses interval */
-               interval = LDAP_LCUP_DEFAULT_SEND_COOKIE_INTERVAL;
+               interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
        }
 
        if ( (tag = ber_peek_tag( ber, &len )) == LBER_DEFAULT ) {
@@ -699,23 +703,23 @@ static int parseClientUpdate (
 
        /* TODO : Cookie Scheme Validation */
 #if 0
-       if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
-               *text = "Invalid LCUP cookie";
-               return LCUP_INVALID_COOKIE;
-       }
-
        if ( lcup_cookie_scheme_validate(scheme) != LDAP_SUCCESS ) {
                *text = "Unsupported LCUP cookie scheme";
                return LCUP_UNSUPPORTED_SCHEME;
        }
+
+       if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
+               *text = "Invalid LCUP cookie";
+               return LCUP_INVALID_COOKIE;
+       }
 #endif
 
-       op->o_clientupdatestate = ber_dupbv(NULL, &cookie);
+       ber_dupbv( &op->o_clientupdate_state, &cookie );
 
        (void) ber_free( ber, 1 );
 
-       op->o_clientupdatetype = type;
-       op->o_clientupdateinterval = interval;
+       op->o_clientupdate_type = (char) type;
+       op->o_clientupdate_interval = interval;
 
        op->o_clientupdate = ctrl->ldctl_iscritical
                ? SLAP_CRITICAL_CONTROL
@@ -723,4 +727,4 @@ static int parseClientUpdate (
 
        return LDAP_SUCCESS;
 }
-#endif
+#endif /* LDAP_CLIENT_UPDATE */