Deleted Added
full compact
kadmind.c (72445) kadmind.c (78527)
1/*
1/*
2 * Copyright (c) 1997-2000 Kungliga Tekniska H�gskolan
2 * Copyright (c) 1997-2001 Kungliga Tekniska H�gskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
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
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "kadmin_locl.h"
35
3 * (Royal Institute of Technology, Stockholm, Sweden).
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
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "kadmin_locl.h"
35
36RCSID("$Id: kadmind.c,v 1.24 2000/12/31 07:45:23 assar Exp $");
36RCSID("$Id: kadmind.c,v 1.27 2001/05/14 06:16:41 assar Exp $");
37
38static char *check_library = NULL;
39static char *check_function = NULL;
40static char *config_file;
41static char *keyfile;
42static char *keytab_str = "HDB:";
43static int help_flag;
44static int version_flag;

--- 48 unchanged lines hidden (view full) ---

93{
94 krb5_error_code ret;
95 krb5_config_section *cf;
96 int optind = 0;
97 int e;
98 krb5_log_facility *logf;
99 krb5_keytab keytab;
100
37
38static char *check_library = NULL;
39static char *check_function = NULL;
40static char *config_file;
41static char *keyfile;
42static char *keytab_str = "HDB:";
43static int help_flag;
44static int version_flag;

--- 48 unchanged lines hidden (view full) ---

93{
94 krb5_error_code ret;
95 krb5_config_section *cf;
96 int optind = 0;
97 int e;
98 krb5_log_facility *logf;
99 krb5_keytab keytab;
100
101 set_progname(argv[0]);
101 setprogname(argv[0]);
102
103 ret = krb5_init_context(&context);
104 if (ret)
105 errx (1, "krb5_init_context failed: %d", ret);
106
107 ret = krb5_openlog(context, "kadmind", &logf);
108 ret = krb5_set_warn_dest(context, logf);
109

--- 13 unchanged lines hidden (view full) ---

123
124 ret = krb5_kt_register(context, &hdb_kt_ops);
125 if(ret)
126 krb5_err(context, 1, ret, "krb5_kt_register");
127
128 if (config_file == NULL)
129 config_file = HDB_DB_DIR "/kdc.conf";
130
102
103 ret = krb5_init_context(&context);
104 if (ret)
105 errx (1, "krb5_init_context failed: %d", ret);
106
107 ret = krb5_openlog(context, "kadmind", &logf);
108 ret = krb5_set_warn_dest(context, logf);
109

--- 13 unchanged lines hidden (view full) ---

123
124 ret = krb5_kt_register(context, &hdb_kt_ops);
125 if(ret)
126 krb5_err(context, 1, ret, "krb5_kt_register");
127
128 if (config_file == NULL)
129 config_file = HDB_DB_DIR "/kdc.conf";
130
131 if(krb5_config_parse_file(config_file, &cf) == 0) {
131 if(krb5_config_parse_file(context, config_file, &cf) == 0) {
132 const char *p = krb5_config_get_string (context, cf,
133 "kdc", "key-file", NULL);
134 if (p)
135 keyfile = strdup(p);
136 }
137
138 ret = krb5_kt_resolve(context, keytab_str, &keytab);
139 if(ret)
140 krb5_err(context, 1, ret, "krb5_kt_resolve");
141
142 kadm5_setup_passwd_quality_check (context, check_library, check_function);
143
144 {
145 int fd = 0;
132 const char *p = krb5_config_get_string (context, cf,
133 "kdc", "key-file", NULL);
134 if (p)
135 keyfile = strdup(p);
136 }
137
138 ret = krb5_kt_resolve(context, keytab_str, &keytab);
139 if(ret)
140 krb5_err(context, 1, ret, "krb5_kt_resolve");
141
142 kadm5_setup_passwd_quality_check (context, check_library, check_function);
143
144 {
145 int fd = 0;
146 struct sockaddr sa;
147 socklen_t sa_size;
146 struct sockaddr_storage __ss;
147 struct sockaddr *sa = (struct sockaddr *)&__ss;
148 socklen_t sa_size = sizeof(__ss);
148 krb5_auth_context ac = NULL;
149 int debug_port;
149 krb5_auth_context ac = NULL;
150 int debug_port;
150 sa_size = sizeof(sa);
151
151 if(debug_flag) {
152 if(port_str == NULL)
153 debug_port = krb5_getportbyname (context, "kerberos-adm",
154 "tcp", 749);
155 else
156 debug_port = htons(atoi(port_str));
157 mini_inetd(debug_port);
152 if(debug_flag) {
153 if(port_str == NULL)
154 debug_port = krb5_getportbyname (context, "kerberos-adm",
155 "tcp", 749);
156 else
157 debug_port = htons(atoi(port_str));
158 mini_inetd(debug_port);
158 } else if(roken_getsockname(STDIN_FILENO, &sa, &sa_size) < 0 &&
159 } else if(roken_getsockname(STDIN_FILENO, sa, &sa_size) < 0 &&
159 errno == ENOTSOCK) {
160 parse_ports(context, port_str ? port_str : "+");
161 pidfile(NULL);
162 start_server(context);
163 }
164 if(realm)
165 krb5_set_default_realm(context, realm); /* XXX */
166 kadmind_loop(context, ac, keytab, fd);
167 }
168 return 0;
169}
160 errno == ENOTSOCK) {
161 parse_ports(context, port_str ? port_str : "+");
162 pidfile(NULL);
163 start_server(context);
164 }
165 if(realm)
166 krb5_set_default_realm(context, realm); /* XXX */
167 kadmind_loop(context, ac, keytab, fd);
168 }
169 return 0;
170}