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