]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/config.c
No LogTest in RE23
[openldap] / servers / slapd / back-shell / config.c
index fc22aac49a3d8ceda0ce7eeb8a48b08c9d5b5126..129820491fe1920355f3c6dc80cc1396983e6b82 100644 (file)
@@ -1,19 +1,47 @@
 /* config.c - shell backend configuration file routine */
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2006 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* Portions Copyright (c) 1995 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
+ * (as part of U-MICH LDAP).
+ */
 
 #include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 #include "shell.h"
 
-extern char    **charray_dup();
-
-shell_back_config(
-    Backend    *be,
-    char       *fname,
+int
+shell_back_db_config(
+    BackendDB  *be,
+    const char *fname,
     int                lineno,
     int                argc,
     char       **argv
@@ -24,7 +52,7 @@ shell_back_config(
        if ( si == NULL ) {
                fprintf( stderr, "%s: line %d: shell backend info is null!\n",
                    fname, lineno );
-               exit( 1 );
+               return( 1 );
        }
 
        /* command + args to exec for binds */
@@ -33,9 +61,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"bind <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_bind = charray_dup( &argv[1] );
+               si->si_bind = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for unbinds */
        } else if ( strcasecmp( argv[0], "unbind" ) == 0 ) {
@@ -43,9 +71,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"unbind <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_unbind = charray_dup( &argv[1] );
+               si->si_unbind = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for searches */
        } else if ( strcasecmp( argv[0], "search" ) == 0 ) {
@@ -53,9 +81,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"search <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_search = charray_dup( &argv[1] );
+               si->si_search = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for compares */
        } else if ( strcasecmp( argv[0], "compare" ) == 0 ) {
@@ -63,9 +91,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"compare <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_compare = charray_dup( &argv[1] );
+               si->si_compare = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for modifies */
        } else if ( strcasecmp( argv[0], "modify" ) == 0 ) {
@@ -73,9 +101,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"modify <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_modify = charray_dup( &argv[1] );
+               si->si_modify = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for modrdn */
        } else if ( strcasecmp( argv[0], "modrdn" ) == 0 ) {
@@ -83,9 +111,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"modrdn <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_modrdn = charray_dup( &argv[1] );
+               si->si_modrdn = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for add */
        } else if ( strcasecmp( argv[0], "add" ) == 0 ) {
@@ -93,9 +121,9 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"add <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_add = charray_dup( &argv[1] );
+               si->si_add = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for delete */
        } else if ( strcasecmp( argv[0], "delete" ) == 0 ) {
@@ -103,24 +131,14 @@ shell_back_config(
                        fprintf( stderr,
        "%s: line %d: missing executable in \"delete <executable>\" line\n",
                            fname, lineno );
-                       exit( 1 );
+                       return( 1 );
                }
-               si->si_delete = charray_dup( &argv[1] );
-
-       /* command + args to exec for abandon */
-       } else if ( strcasecmp( argv[0], "abandon" ) == 0 ) {
-               if ( argc < 2 ) {
-                       fprintf( stderr,
-       "%s: line %d: missing executable in \"abandon <executable>\" line\n",
-                           fname, lineno );
-                       exit( 1 );
-               }
-               si->si_abandon = charray_dup( &argv[1] );
+               si->si_delete = ldap_charray_dup( &argv[1] );
 
        /* anything else */
        } else {
-               fprintf( stderr,
-"%s: line %d: unknown directive \"%s\" in shell database definition (ignored)\n",
-                   fname, lineno, argv[0] );
+               return SLAP_CONF_UNKNOWN;
        }
+
+       return 0;
 }