]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Update with latest NT mods.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 6 Nov 1998 01:32:41 +0000 (01:32 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 6 Nov 1998 01:32:41 +0000 (01:32 +0000)
clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldapsearch.c
clients/tools/ldapsearch.dsp

index 3054cfb54fe52aacc397d621398c0fb2f6187a86..93b9f0de61983ad9b720095f44022053b0766596 100644 (file)
@@ -1,17 +1,22 @@
 /* ldapdelete.c - simple program to delete an entry using LDAP */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
 #include <lber.h>
 #include <ldap.h>
 
 #include "ldapconfig.h"
 
 static char    *binddn = LDAPDELETE_BINDDN;
+static char    *passwd = LDAPDELETE_BIND_CRED;
 static char    *base = LDAPDELETE_BASE;
-static char    *passwd = NULL;
 static char    *ldaphost = LDAPHOST;
 static int     ldapport = LDAP_PORT;
 static int     not, verbose, contoper;
@@ -24,15 +29,18 @@ extern int ldap_debug, lber_debug;
 #define safe_realloc( ptr, size )      ( ptr == NULL ? malloc( size ) : \
                                         realloc( ptr, size ))
 
+static int dodelete LDAP_P((
+    LDAP       *ld,
+    char       *dn));
 
 main( argc, argv )
     int                argc;
     char       **argv;
 {
     char               *usage = "usage: %s [-n] [-v] [-k] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
-    char               *p, buf[ 4096 ];
+    char               buf[ 4096 ];
     FILE               *fp;
-    int                        i, rc, kerberos, linenum, authmethod;
+    int                        i, rc, kerberos, authmethod;
 
     extern char        *optarg;
     extern int optind;
@@ -130,12 +138,15 @@ main( argc, argv )
     ldap_unbind( ld );
 
     exit( rc );
+
+       /* UNREACHABLE */
+       return(0);
 }
 
 
-dodelete( ld, dn )
-    LDAP       *ld;
-    char       *dn;
+static int dodelete(
+    LDAP       *ld,
+    char       *dn)
 {
     int        rc;
 
index fa87c3d571e9b9d308fc31eb5386d23305ec3d7c..2d3506eff129e562540ab682e25150bbbab247b8 100644 (file)
@@ -226,6 +226,9 @@ main( int argc, char **argv )
     }
 
     exit( rc );
+
+       /* UNREACHABLE */
+       return(0);
 }
 
 
index aaffe4c170ae68d123974712ee93893a5b7aaa6f..a00d259d340120a8e0adb81086f94b9172c19b0f 100644 (file)
@@ -172,6 +172,9 @@ main( argc, argv )
     ldap_unbind( ld );
 
     exit( rc );
+
+       /* UNREACHABLE */
+       return(0);
 }
 
 static int domodrdn(
index d96aff131711ea7bc85bde1ed6194a246c2d7afc..baa67d649b30ef1c3ac8af26e5deafc03389a67d 100644 (file)
@@ -1,6 +1,13 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
 #include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
 #include <lber.h>
 #include <ldap.h>
 #include <ldif.h>
@@ -14,7 +21,7 @@ extern int ldap_debug, lber_debug;
 #endif /* LDAP_DEBUG */
 
 
-usage( s )
+static void usage( s )
 char   *s;
 {
     fprintf( stderr, "usage: %s [options] filter [attributes...]\nwhere:\n", s );
@@ -43,7 +50,7 @@ char  *s;
     fprintf( stderr, "    -z size lim\tsize limit (in entries) for search\n" );
     fprintf( stderr, "    -D binddn\tbind dn\n" );
     fprintf( stderr, "    -w passwd\tbind passwd (for simple authentication)\n" );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
     fprintf( stderr, "    -k\t\tuse Kerberos instead of Simple Password authentication\n" );
 #endif
     fprintf( stderr, "    -h host\tldap server\n" );
@@ -51,8 +58,27 @@ char *s;
     exit( 1 );
 }
 
+static void print_entry LDAP_P((
+    LDAP       *ld,
+    LDAPMessage        *entry,
+    int                attrsonly));
+
+static int write_ldif_value LDAP_P((
+       char *type,
+       char *value,
+       unsigned long vallen ));
+
+static int dosearch LDAP_P((
+       LDAP    *ld,
+    char       *base,
+    int                scope,
+    char       **attrs,
+    int                attrsonly,
+    char       *filtpatt,
+    char       *value));
+
 static char    *binddn = LDAPSEARCH_BINDDN;
-static char    *passwd = NULL;
+static char    *passwd = LDAPSEARCH_BIND_CRED;
 static char    *base = LDAPSEARCH_BASE;
 static char    *ldaphost = LDAPHOST;
 static int     ldapport = LDAP_PORT;
@@ -85,7 +111,7 @@ char **argv;
     scope = LDAP_SCOPE_SUBTREE;
 
     while (( i = getopt( argc, argv,
-#ifdef KERBEROS
+#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:"
@@ -105,7 +131,7 @@ char        **argv;
            fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
 #endif /* LDAP_DEBUG */
            break;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        case 'k':       /* use kerberos bind */
            kerberos = 2;
            break;
@@ -291,19 +317,22 @@ char      **argv;
 
     ldap_unbind( ld );
     exit( rc );
+
+       /* UNREACHABLE */
+       return(0);
 }
 
 
-dosearch( ld, base, scope, attrs, attrsonly, filtpatt, value )
-    LDAP       *ld;
-    char       *base;
-    int                scope;
-    char       **attrs;
-    int                attrsonly;
-    char       *filtpatt;
-    char       *value;
+static int dosearch(
+       LDAP    *ld,
+    char       *base,
+    int                scope,
+    char       **attrs,
+    int                attrsonly,
+    char       *filtpatt,
+    char       *value)
 {
-    char               filter[ BUFSIZ ], **val;
+    char               filter[ BUFSIZ ];
     int                        rc, first, matches;
     LDAPMessage                *res, *e;
 
@@ -371,10 +400,10 @@ dosearch( ld, base, scope, attrs, attrsonly, filtpatt, value )
 }
 
 
-print_entry( ld, entry, attrsonly )
-    LDAP       *ld;
-    LDAPMessage        *entry;
-    int                attrsonly;
+void print_entry(
+    LDAP       *ld,
+    LDAPMessage        *entry,
+    int                attrsonly)
 {
     char               *a, *dn, *ufn, tmpfname[ 64 ];
     int                        i, j, notascii;
@@ -436,7 +465,7 @@ print_entry( ld, entry, attrsonly )
                } else {
                    notascii = 0;
                    if ( !allow_binary ) {
-                       for ( j = 0; j < bvals[ i ]->bv_len; ++j ) {
+                       for ( j = 0; (unsigned long) j < bvals[ i ]->bv_len; ++j ) {
                            if ( !isascii( bvals[ i ]->bv_val[ j ] )) {
                                notascii = 1;
                                break;
index 9927479c89dc0cf7faedddedf595fd8b8c2d7018..986dd35c5e0d3f7ba94ba86a57866709a8cf989e 100644 (file)
@@ -43,7 +43,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /Ze /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe