char *usage = "usage: %s [-n] [-v] [-k] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
char buf[ 4096 ];
FILE *fp;
- int i, rc, kerberos, authmethod;
+ int i, rc, authmethod;
- kerberos = not = verbose = contoper = 0;
+ not = verbose = contoper = 0;
fp = NULL;
+ authmethod = LDAP_AUTH_SIMPLE;
while (( i = getopt( argc, argv, "nvkKch:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
case 'k': /* kerberos bind */
- kerberos = 2;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV4;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'K': /* kerberos bind, part one only */
- kerberos = 1;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV41;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'c': /* continuous operation mode */
++contoper;
ld->ld_deref = LDAP_DEREF_NEVER; /* prudent, but probably unnecessary */
- if ( !kerberos ) {
- authmethod = LDAP_AUTH_SIMPLE;
- } else if ( kerberos == 1 ) {
- authmethod = LDAP_AUTH_KRBV41;
- } else {
- authmethod = LDAP_AUTH_KRBV4;
- }
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( 1 );
{
char *infile, *rbuf, *start, *p, *q;
FILE *fp;
- int rc, i, kerberos, use_ldif, authmethod;
+ int rc, i, use_ldif, authmethod;
char *usage = "usage: %s [-abcknrvF] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n";
if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) {
new = ( strcmp( prog, "ldapadd" ) == 0 );
infile = NULL;
- kerberos = not = verbose = valsfromfiles = 0;
+ not = verbose = valsfromfiles = 0;
+ authmethod = LDAP_AUTH_SIMPLE;
while (( i = getopt( argc, argv, "FabckKnrtvh:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
replace = 1;
break;
case 'k': /* kerberos bind */
- kerberos = 2;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV4;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'K': /* kerberos bind, part 1 only */
- kerberos = 1;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV41;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'F': /* force all changes records to be used */
force = 1;
ld->ld_deref = LDAP_DEREF_NEVER; /* this seems prudent */
- if ( !kerberos ) {
- authmethod = LDAP_AUTH_SIMPLE;
- } else if ( kerberos == 1 ) {
- authmethod = LDAP_AUTH_KRBV41;
- } else {
- authmethod = LDAP_AUTH_KRBV4;
- }
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( 1 );
char *usage = "usage: %s [-nvkc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
char *myname,*infile, *entrydn, *rdn, buf[ 4096 ];
FILE *fp;
- int rc, i, kerberos, remove, havedn, authmethod;
+ int rc, i, remove, havedn, authmethod;
infile = NULL;
- kerberos = not = contoper = verbose = remove = 0;
+ not = contoper = verbose = remove = 0;
+ authmethod = LDAP_AUTH_SIMPLE;
myname = (myname = strrchr(argv[0], '/')) == NULL ? argv[0] : ++myname;
while (( i = getopt( argc, argv, "kKcnvrh:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
case 'k': /* kerberos bind */
- kerberos = 2;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV4;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'K': /* kerberos bind, part one only */
- kerberos = 1;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV41;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'c': /* continuous operation mode */
++contoper;
ld->ld_deref = LDAP_DEREF_NEVER; /* this seems prudent */
- if ( !kerberos ) {
- authmethod = LDAP_AUTH_SIMPLE;
- } else if ( kerberos == 1 ) {
- authmethod = LDAP_AUTH_KRBV41;
- } else {
- authmethod = LDAP_AUTH_KRBV4;
- }
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( 1 );
{
char *infile, *filtpattern, **attrs, line[ BUFSIZ ];
FILE *fp;
- int rc, i, first, scope, kerberos, deref, attrsonly;
+ int rc, i, first, scope, deref, attrsonly;
int ldap_options, timelimit, sizelimit, authmethod;
LDAP *ld;
infile = NULL;
- verbose = allow_binary = not = kerberos = vals2tmp =
+ verbose = allow_binary = not = vals2tmp =
attrsonly = ldif = 0;
+
#ifdef LDAP_REFERRALS
ldap_options = LDAP_OPT_REFERRALS;
#else /* LDAP_REFERRALS */
deref = sizelimit = timelimit = -1;
scope = LDAP_SCOPE_SUBTREE;
+ authmethod = LDAP_AUTH_SIMPLE;
- while (( i = getopt( argc, argv,
-#ifdef HAVE_KERBEROS
- "KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
-#else
- "nuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
-#endif
- )) != EOF ) {
+ while (( i = getopt( argc, argv, "KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:")) != EOF ) {
switch( i ) {
case 'n': /* do Not do any searches */
++not;
fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
#endif /* LDAP_DEBUG */
break;
-#ifdef HAVE_KERBEROS
case 'k': /* use kerberos bind */
- kerberos = 2;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV4;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
+#endif
break;
case 'K': /* use kerberos bind, 1st part only */
- kerberos = 1;
- break;
+#ifdef HAVE_KERBEROS
+ authmethod = LDAP_AUTH_KRBV41;
+#else
+ fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
#endif
+ break;
case 'u': /* include UFN */
++includeufn;
break;
}
ld->ld_options = ldap_options;
- if ( !kerberos ) {
- authmethod = LDAP_AUTH_SIMPLE;
- } else if ( kerberos == 1 ) {
- authmethod = LDAP_AUTH_KRBV41;
- } else {
- authmethod = LDAP_AUTH_KRBV4;
- }
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( 1 );