Deleted Added
full compact
config.c (78527) config.c (90926)
1/*
1/*
2 * Copyright (c) 1997-2001 Kungliga Tekniska H�gskolan
2 * Copyright (c) 1997-2002 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

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

30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "kdc_locl.h"
35#include <getarg.h>
36#include <parse_bytes.h>
37
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

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

30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "kdc_locl.h"
35#include <getarg.h>
36#include <parse_bytes.h>
37
38RCSID("$Id: config.c,v 1.36 2001/05/17 07:13:43 joda Exp $");
38RCSID("$Id: config.c,v 1.39 2002/02/04 10:53:48 joda Exp $");
39
40static char *config_file; /* location of kdc config file */
41
42int require_preauth = -1; /* 1 == require preauth for all principals */
43
44size_t max_request; /* maximal size of a request */
45
46static char *max_request_str; /* `max_request' as a string */

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

62
63static struct getarg_strings addresses_str; /* addresses to listen on */
64krb5_addresses explicit_addresses;
65
66#ifdef KRB4
67char *v4_realm;
68int enable_v4 = -1;
69int enable_524 = -1;
39
40static char *config_file; /* location of kdc config file */
41
42int require_preauth = -1; /* 1 == require preauth for all principals */
43
44size_t max_request; /* maximal size of a request */
45
46static char *max_request_str; /* `max_request' as a string */

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

62
63static struct getarg_strings addresses_str; /* addresses to listen on */
64krb5_addresses explicit_addresses;
65
66#ifdef KRB4
67char *v4_realm;
68int enable_v4 = -1;
69int enable_524 = -1;
70int enable_kaserver = -1;
70#endif
71#endif
71#ifdef KASERVER
72krb5_boolean enable_kaserver = -1;
73#endif
74
75static int help_flag;
76static int version_flag;
77
78static struct getargs args[] = {
79 {
80 "config-file", 'c', arg_string, &config_file,
81 "location of config file", "file"

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

101 },
102 { "524", 0, arg_negative_flag, &enable_524,
103 "don't respond to 524 requests"
104 },
105 {
106 "v4-realm", 'r', arg_string, &v4_realm,
107 "realm to serve v4-requests for"
108 },
72
73static int help_flag;
74static int version_flag;
75
76static struct getargs args[] = {
77 {
78 "config-file", 'c', arg_string, &config_file,
79 "location of config file", "file"

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

99 },
100 { "524", 0, arg_negative_flag, &enable_524,
101 "don't respond to 524 requests"
102 },
103 {
104 "v4-realm", 'r', arg_string, &v4_realm,
105 "realm to serve v4-requests for"
106 },
109#endif
110#ifdef KASERVER
111 {
107 {
112 "kaserver", 'K', arg_negative_flag, &enable_kaserver,
113 "turn off kaserver support"
108 "kaserver", 'K', arg_flag, &enable_kaserver,
109 "enable kaserver support"
114 },
115#endif
116 { "ports", 'P', arg_string, &port_str,
110 },
111#endif
112 { "ports", 'P', arg_string, &port_str,
117 "ports to listen to"
113 "ports to listen to", "portspec"
118 },
119 { "addresses", 0, arg_strings, &addresses_str,
120 "addresses to listen on", "list of addresses" },
121 { "help", 'h', arg_flag, &help_flag },
122 { "version", 'v', arg_flag, &version_flag }
123};
124
125static int num_args = sizeof(args) / sizeof(args[0]);

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

180 }
181 p = krb5_config_get_string(context, default_binding, "mkey_file", NULL);
182 if(p) {
183 di->mkey_file = strdup(p);
184 default_mkey = p;
185 }
186 *dt = di;
187 dt = &di->next;
114 },
115 { "addresses", 0, arg_strings, &addresses_str,
116 "addresses to listen on", "list of addresses" },
117 { "help", 'h', arg_flag, &help_flag },
118 { "version", 'v', arg_flag, &version_flag }
119};
120
121static int num_args = sizeof(args) / sizeof(args[0]);

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

176 }
177 p = krb5_config_get_string(context, default_binding, "mkey_file", NULL);
178 if(p) {
179 di->mkey_file = strdup(p);
180 default_mkey = p;
181 }
182 *dt = di;
183 dt = &di->next;
188 } else {
184 } else if(databases == NULL) {
185 /* if there are none specified, use some default */
189 di = calloc(1, sizeof(*di));
190 di->dbname = strdup(default_dbname);
191 di->mkey_file = strdup(default_mkey);
192 *dt = di;
193 dt = &di->next;
194 }
195 for(di = databases; di; di = di->next) {
196 if(di->dbname == NULL)
197 di->dbname = strdup(default_dbname);
198 if(di->mkey_file == NULL) {
199 p = strrchr(di->dbname, '.');
200 if(p == NULL || strchr(p, '/') != NULL)
186 di = calloc(1, sizeof(*di));
187 di->dbname = strdup(default_dbname);
188 di->mkey_file = strdup(default_mkey);
189 *dt = di;
190 dt = &di->next;
191 }
192 for(di = databases; di; di = di->next) {
193 if(di->dbname == NULL)
194 di->dbname = strdup(default_dbname);
195 if(di->mkey_file == NULL) {
196 p = strrchr(di->dbname, '.');
197 if(p == NULL || strchr(p, '/') != NULL)
198 /* final pathname component does not contain a . */
201 asprintf(&di->mkey_file, "%s.mkey", di->dbname);
202 else
199 asprintf(&di->mkey_file, "%s.mkey", di->dbname);
200 else
201 /* the filename is something.else, replace .else with
202 .mkey */
203 asprintf(&di->mkey_file, "%.*s.mkey",
204 (int)(p - di->dbname), di->dbname);
205 }
206 }
207}
208
209static void
210add_one_address (const char *str, int first)

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

324 if(v4_realm == NULL){
325 p = krb5_config_get_string (context, cf,
326 "kdc",
327 "v4-realm",
328 NULL);
329 if(p)
330 v4_realm = strdup(p);
331 }
203 asprintf(&di->mkey_file, "%.*s.mkey",
204 (int)(p - di->dbname), di->dbname);
205 }
206 }
207}
208
209static void
210add_one_address (const char *str, int first)

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

324 if(v4_realm == NULL){
325 p = krb5_config_get_string (context, cf,
326 "kdc",
327 "v4-realm",
328 NULL);
329 if(p)
330 v4_realm = strdup(p);
331 }
332#endif
333#ifdef KASERVER
334 if (enable_kaserver == -1)
332 if (enable_kaserver == -1)
335 enable_kaserver = krb5_config_get_bool_default(context, cf, TRUE,
333 enable_kaserver = krb5_config_get_bool_default(context, cf, FALSE,
336 "kdc",
337 "enable-kaserver",
338 NULL);
339#endif
340
341 encode_as_rep_as_tgs_rep = krb5_config_get_bool(context, cf, "kdc",
342 "encode_as_rep_as_tgs_rep",
343 NULL);

--- 21 unchanged lines hidden ---
334 "kdc",
335 "enable-kaserver",
336 NULL);
337#endif
338
339 encode_as_rep_as_tgs_rep = krb5_config_get_bool(context, cf, "kdc",
340 "encode_as_rep_as_tgs_rep",
341 NULL);

--- 21 unchanged lines hidden ---