]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/config.c
Fix last commit: C90 rejects declaration after code
[openldap] / servers / slapd / back-shell / config.c
index 7c1e14e7ff8b1029eb4198c75c321fb89e928303..6a4f191088862931d0dc41421400a0988711013c 100644 (file)
@@ -1,8 +1,31 @@
 /* config.c - shell backend configuration file routine */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2009 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 "slap.h"
 #include "shell.h"
 
-#ifdef SHELL_SURROGATE_PARENT
-
-static struct berval make_cmd_info(
-       char **args
-)
-{
-       struct berval ret = { 0, 0 };
-       int i;
-       ber_len_t offset;
-       for( i = 0; args[i] != NULL; i++ )
-               ret.bv_len += strlen( args[i] ) + 1;
-       ret.bv_val = ch_malloc( ret.bv_len );
-       offset = 0;
-       for( i = 0; args[i] != NULL; i++ ) {
-               strcpy( ret.bv_val + offset, args[i] );
-               offset += strlen( args[i] ) + 1;
-       }
-       return ret;
-}
-
-#endif /* SHELL_SURROGATE_PARENT */
-
 int
 shell_back_db_config(
     BackendDB  *be,
@@ -62,7 +63,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_bind = MAKE_CMD_INFO( &argv[1] );
+               si->si_bind = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for unbinds */
        } else if ( strcasecmp( argv[0], "unbind" ) == 0 ) {
@@ -72,7 +73,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_unbind = MAKE_CMD_INFO( &argv[1] );
+               si->si_unbind = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for searches */
        } else if ( strcasecmp( argv[0], "search" ) == 0 ) {
@@ -82,7 +83,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_search = MAKE_CMD_INFO( &argv[1] );
+               si->si_search = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for compares */
        } else if ( strcasecmp( argv[0], "compare" ) == 0 ) {
@@ -92,7 +93,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_compare = MAKE_CMD_INFO( &argv[1] );
+               si->si_compare = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for modifies */
        } else if ( strcasecmp( argv[0], "modify" ) == 0 ) {
@@ -102,7 +103,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_modify = MAKE_CMD_INFO( &argv[1] );
+               si->si_modify = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for modrdn */
        } else if ( strcasecmp( argv[0], "modrdn" ) == 0 ) {
@@ -112,7 +113,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_modrdn = MAKE_CMD_INFO( &argv[1] );
+               si->si_modrdn = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for add */
        } else if ( strcasecmp( argv[0], "add" ) == 0 ) {
@@ -122,7 +123,7 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_add = MAKE_CMD_INFO( &argv[1] );
+               si->si_add = ldap_charray_dup( &argv[1] );
 
        /* command + args to exec for delete */
        } else if ( strcasecmp( argv[0], "delete" ) == 0 ) {
@@ -132,23 +133,11 @@ shell_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               si->si_delete = MAKE_CMD_INFO( &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 );
-                       return( 1 );
-               }
-               si->si_abandon = MAKE_CMD_INFO( &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;