]> git.sur5r.net Git - openldap/commitdiff
StartTLS requires LDAPv3
authorKurt Zeilenga <kurt@openldap.org>
Thu, 20 Apr 2000 14:15:39 +0000 (14:15 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 20 Apr 2000 14:15:39 +0000 (14:15 +0000)
Set version to required protocol.

clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldappasswd.c
clients/tools/ldapsearch.c

index bd2a61f1bf1c8876bbd9db401281f0f95e146684..4cbf84f1eea8e852a5efe818e52a16eec365b268 100644 (file)
@@ -240,23 +240,34 @@ main( int argc, char **argv )
 
        if ( ( authmethod == LDAP_AUTH_KRBV4 ) || ( authmethod ==
                        LDAP_AUTH_KRBV41 ) ) {
-               if( version != LDAP_VERSION2 ) {
+               if( version > LDAP_VERSION2 ) {
                        fprintf( stderr, "Kerberos requires LDAPv2\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION2;
        }
        else if ( authmethod == LDAP_AUTH_SASL ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf( stderr, "SASL requires LDAPv3\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION3;
        }
 
        if( manageDSAit ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf(stderr, "manage DSA control requires LDAPv3\n");
                        return EXIT_FAILURE;
                }
+               version = LDAP_VERSION3;
+       }
+
+       if( use_tls ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
+                       fprintf(stderr, "Start TLS requires LDAPv3\n");
+                       return EXIT_FAILURE;
+               }
+               version = LDAP_VERSION3;
        }
 
     if ( fp == NULL ) {
index eed0b3f1810c9757663f585fa4bf56d7b7bbec32..034b611b7ca14915ab03266757f650a6ea89318f 100644 (file)
@@ -300,23 +300,34 @@ main( int argc, char **argv )
 
        if ( ( authmethod == LDAP_AUTH_KRBV4 ) || ( authmethod ==
                        LDAP_AUTH_KRBV41 ) ) {
-               if( version != LDAP_VERSION2 ) {
+               if( version > LDAP_VERSION2 ) {
                        fprintf( stderr, "Kerberos requires LDAPv2\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION2;
        }
        else if ( authmethod == LDAP_AUTH_SASL ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf( stderr, "SASL requires LDAPv3\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION3;
        }
 
        if( manageDSAit ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf(stderr, "manage DSA control requires LDAPv3\n");
                        return EXIT_FAILURE;
                }
+               version = LDAP_VERSION3;
+       }
+
+       if( use_tls ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
+                       fprintf(stderr, "Start TLS requires LDAPv3\n");
+                       return EXIT_FAILURE;
+               }
+               version = LDAP_VERSION3;
        }
 
     if ( infile != NULL ) {
index dbfe1629f8907eb878ba91489fd8d343a1f1442c..360bb20c2b20504d988a6bdde773c1b488c9dc5c 100644 (file)
@@ -256,23 +256,34 @@ main(int argc, char **argv)
 
        if ( ( authmethod == LDAP_AUTH_KRBV4 ) || ( authmethod ==
                        LDAP_AUTH_KRBV41 ) ) {
-               if( version != LDAP_VERSION2 ) {
+               if( version > LDAP_VERSION2 ) {
                        fprintf( stderr, "Kerberos requires LDAPv2\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION2;
        }
        else if ( authmethod == LDAP_AUTH_SASL ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf( stderr, "SASL requires LDAPv3\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION3;
        }
 
        if( manageDSAit ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf(stderr, "manage DSA control requires LDAPv3\n");
                        return EXIT_FAILURE;
                }
+               version = LDAP_VERSION3;
+       }
+
+       if( use_tls ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
+                       fprintf(stderr, "Start TLS requires LDAPv3\n");
+                       return EXIT_FAILURE;
+               }
+               version = LDAP_VERSION3;
        }
 
     if (newSuperior != NULL) {
@@ -283,6 +294,7 @@ main(int argc, char **argv)
                        usage( argv[0] );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION3;
     }
     
     havedn = 0;
index 70de7e66890002f66b3db00b63c65cc7a50cba9f..a5cd3db7ae960a5a8113c11224ab93a6ea34606e 100644 (file)
@@ -302,6 +302,7 @@ main( int argc, char *argv[] )
        /* don't chase referrals */
        ldap_set_option( ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF );
 
+       /* LDAPv3 only */
        version = 3;
        rc = ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
 
@@ -448,5 +449,5 @@ main( int argc, char *argv[] )
        /* disconnect from server */
        ldap_unbind (ld);
 
-       return ( EXIT_SUCCESS );
+       return EXIT_SUCCESS;
 }
index ab700a729b9bbf287dd902275d0b588c3cd2d139..2603107e438c491b710ce149772138cb9459b2c4 100644 (file)
@@ -363,24 +363,34 @@ main( int argc, char **argv )
 
        if ( ( authmethod == LDAP_AUTH_KRBV4 ) || ( authmethod ==
                        LDAP_AUTH_KRBV41 ) ) {
-               if( version != LDAP_VERSION2 ) {
-
+               if( version > LDAP_VERSION2 ) {
                        fprintf( stderr, "Kerberos requires LDAPv2\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION2;
        }
        else if ( authmethod == LDAP_AUTH_SASL ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf( stderr, "SASL requires LDAPv3\n" );
                        return( EXIT_FAILURE );
                }
+               version = LDAP_VERSION3;
        }
 
        if( manageDSAit ) {
-               if( version != LDAP_VERSION3 ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
                        fprintf(stderr, "manage DSA control requires LDAPv3\n");
                        return EXIT_FAILURE;
                }
+               version = LDAP_VERSION3;
+       }
+
+       if( use_tls ) {
+               if( version != -1 || version != LDAP_VERSION3 ) {
+                       fprintf(stderr, "Start TLS requires LDAPv3\n");
+                       return EXIT_FAILURE;
+               }
+               version = LDAP_VERSION3;
        }
 
        if ( argc - optind < 1 ) {