]> git.sur5r.net Git - openldap/blobdiff - contrib/web_ldap/web_ldap.c
New backend routine: back_attribute
[openldap] / contrib / web_ldap / web_ldap.c
index c37ef3846c13c9e081b9515162d37afa4a14fbb7..8747269551827ee6b1cd5bceb1ae115c51b28dfe 100644 (file)
@@ -7,19 +7,19 @@
 
 #include "portable.h"
 
-#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
-#include <time.h>
 
-#include <ac/unistd.h>
+#include <ac/stdlib.h>
 #include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
 
 #include <lber.h>
 #include <ldap.h>
-#include <ldif.h> 
+#include "ldif.h"
 #include "maint_form.h" /* for HTML Form manipulations */
 
 /* default values */
@@ -178,12 +178,12 @@ main(int argc, char ** argv) {
       if (strcompare(getenv("REQUEST_METHOD"),"POST"))
        {
           printf("<p>++ Error - This script should be referenced with a METHOD of POST.\n");
-          exit(1);
+          exit( EXIT_FAILURE );
        }
       if (strcompare(getenv("CONTENT_TYPE"),"application/x-www-form-urlencoded"))
        {
           printf("<p>++ Error - This script can only be used to decode form results. \n");
-          exit(1);
+          exit( EXIT_FAILURE );
        }
       cl = atoi(getenv("CONTENT_LENGTH"));
       
@@ -209,7 +209,7 @@ main(int argc, char ** argv) {
           printf("%s%s%s", "This script expected a 'FORM' value returned ",
                  "and did not get one.  Make sure the HTML used for this ",
                  "script is correct.");
-          exit(1);
+          exit( EXIT_FAILURE );
        } 
       
       /* Looking for:
@@ -321,27 +321,27 @@ main(int argc, char ** argv) {
         time(&now);
         sprintf(temp,"\n==< Results >==\n\n");
         fputs(temp,logfp);
-        sprintf(temp,"** performing ldap_open at %s\n", ctime(&now));
+        sprintf(temp,"** performing ldap_init at %s\n", ctime(&now));
         fputs(temp,logfp);
         fflush(logfp);
         fclose(logfp);
       }
    }
-   if ( (ld = ldap_open(ldap_data.servername, ldap_data.ldap_port_num) ) == NULL)
+   if ( (ld = ldap_init(ldap_data.servername, ldap_data.ldap_port_num) ) == NULL)
      {
-       printf("<font color=red><b>ldap_open error</b></font>\n");
+       printf("<font color=red><b>ldap_init error</b></font>\n");
        if (ldap_data.debug != 0) {
           if ((logfp = fopen("web_ldap.log","a")) == 0) {
           }
           else {
-             sprintf(temp,"++ ldap_open error\n");
+             sprintf(temp,"++ ldap_init error\n");
              fputs(temp,logfp);
              fflush(logfp);
              fclose(logfp);
           }
        }
        printf("</body>\n</html>\n");
-       exit(1);
+       exit( EXIT_FAILURE );
      }
    
    /*authenticate as nobody */
@@ -373,7 +373,7 @@ main(int argc, char ** argv) {
           }
        }
        printf("</body>\n</html>\n");
-       exit(1);
+       exit( EXIT_FAILURE );
      }
    
    printf("<b>Directory Lookup Results</b>\n<pre>\n");