1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* plugins/kdb/ldap/ldap_util/kdb5_ldap_util.h */ 3 /* Copyright (c) 2004-2005, Novell, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * * Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * * The copyright holder's name is not used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #include "kdb_ldap.h" 31 #include "kdb5_ldap_realm.h" 32 #include "kdb5_ldap_services.h" 33 #include "kdb5_ldap_policy.h" 34 35 #define MAIN_HELP -1 36 #define CREATE_REALM 1 37 #define MODIFY_REALM 2 38 #define VIEW_REALM 3 39 #define DESTROY_REALM 4 40 #define LIST_REALM 5 41 42 #define STASH_SRV_PW 17 43 44 #define CREATE_POLICY 11 45 #define MODIFY_POLICY 12 46 #define VIEW_POLICY 13 47 #define DESTROY_POLICY 14 48 #define LIST_POLICY 15 49 50 extern char *progname; 51 52 extern int exit_status; 53 extern krb5_context util_context; 54 55 extern void usage(void); 56 extern void db_usage(int); 57 58 #define ARG_VAL (--argc > 0 ? (koptarg = *(++argv)) : (char *)(db_usage(MAIN_HELP), NULL)) 59 60 /* Following are the bitmaps that indicate which of the options among -D, -w, -h, -p & -t 61 * were specified on the command line. 62 */ 63 #define CMD_LDAP_D 0x1 /* set if -D option is specified */ 64 #define CMD_LDAP_W 0x2 /* set if -w option is specified */ 65 #define CMD_LDAP_H 0x4 /* set if -h option is specified */ 66 #define CMD_LDAP_P 0x8 /* set if -p option is specified */ 67 68 #define MAX_PASSWD_LEN 1024 69 #define MAX_PASSWD_PROMPT_LEN 276 /* max_dn_size(=256) + strlen("Password for \" \"")=20 */ 70