KRB5_PROTOTYPE((krb5_context,
int));
krb5_error_code net_dispatch
- KRB5_PROTOTYPE((krb5_context));
+ KRB5_PROTOTYPE((krb5_context, int));
krb5_principal net_server_princ();
/* proto_serv.c */
if (nwrite != 1)
kret = KRB5KRB_ERR_GENERIC;
+#ifdef USE_KDB5_CPW
+ /* it's only a copy under the new code, see memcpy above */
(void) krb5_db_free_principal(kcontext, &entry2write, 1);
+#endif /* USE_KDB5_CPW */
cleanup:
#ifndef USE_KDB5_CPW
* the case where the ACL file is not present, this entry controls what can
* be done. The default is that everybody can change their own password.
*/
-static const char *acl_catchall_entry = "* o";
+static const char *acl_catchall_entry = "* o ";
static const char *acl_line2long_msg = "%s: line %d too long, truncated\n";
static const char *acl_op_bad_msg = "Unrecognized ACL operation '%c' in %s\n";
static int
acl_load_acl_file()
{
+char tmpbuf[10];
FILE *afp;
char *alinep;
aent_t **aentpp;
acl_list_tail = *aentpp;
aentpp = &(*aentpp)->ae_next;
}
- if (*aentpp = acl_parse_line(acl_catchall_entry)) {
+strcpy(tmpbuf, acl_catchall_entry);
+ if (*aentpp = acl_parse_line(tmpbuf)) {
acl_list_tail = *aentpp;
}
else {
* is none, then we want to create it. This way, kadmind5 becomes just
* a plug in and go kind of utility.
*/
- kret = key_get_admin_entry(kcontext, debug_level);
+ kret = key_get_admin_entry(kcontext);
cleanup:
if (kret) {
krb5_xfree(xsalt);
}
break;
+ case KRB5_KDB_SALTTYPE_AFS3:
+ {
+ /* use KDC-supplied realm for TransArc AFS style salt */
+ /* malloc and copy to cover trailing 0, mit_afs_string_to_key
+ takes care of free'ing it. */
+ char *dat;
+ int len;
+ len = krb5_princ_realm(argp->context, argp->dbentry->princ)->length;
+ dat = malloc(1+len);
+ if (!dat)
+ goto done;
+ strncpy(dat, krb5_princ_realm(argp->context, argp->dbentry->princ)->data, len);
+ dat[len] = 0;
+ salt.data = dat;
+ salt.length = -1; /* in order to get around API change */
+ break;
+ }
default:
goto done;
}
argp->string,
&salt)))
goto done;
+
+ if (salt.length == -1)
+ salt.length = strlen (salt.data);
/*
* Now, salt contains the salt and key contains the decrypted
int manual_entry = 0;
krb5_boolean mime_enabled = 0;
int debug_level = 0;
- int timeout = -1;
int nofork = 0;
+ int timeout = -1;
krb5_int32 service_port = -1;
char *acl_file = (char *) NULL;
char *db_file = (char *) NULL;
char *stash_name = (char *) NULL;
krb5_deltat maxlife = -1;
krb5_deltat maxrlife = -1;
- krb5_timestamp def_expiration;
- krb5_flags def_flags;
+ krb5_timestamp def_expiration = 0;
+ krb5_flags def_flags = 0;
krb5_boolean exp_valid, flags_valid;
krb5_realm_params *rparams;
krb5_int32 realm_num_keysalts;
/*
* net_dispatch() only returns when we're done for some reason.
*/
- error = net_dispatch(kcontext);
+ error = net_dispatch(kcontext, !nofork);
com_err(programname, error,
((error) ? disp_err_fmt : happy_exit_fmt));
* comes in, dispatch to net_client_connect().
*/
krb5_error_code
-net_dispatch(kcontext)
+net_dispatch(kcontext, detached)
krb5_context kcontext;
+ int detached;
{
krb5_error_code kret;
fd_set mask, readfds;
#ifdef DEBUG
(void) sigaction(SIGINT, &s_action, (struct sigaction *) NULL);
#endif /* DEBUG */
+ if (!detached)
+ (void) sigaction(SIGHUP, &s_action, (struct sigaction *) NULL);
#else /* POSIX_SIGNALS */
/*
- * SIGTERM (or SIGINT, if debug) shuts us down.
+ * SIGTERM (or SIGINT, if debug, or SIGHUP if not detached) shuts us down.
*/
signal(SIGTERM, net_shutdown);
#ifdef DEBUG
signal(SIGINT, net_shutdown);
#endif /* DEBUG */
+ if (!detached)
+ signal(SIGHUP, net_shutdown);
#endif /* POSIX_SIGNALS */
#if !USE_PTHREADS
{
char *ret;
char *ermsg;
- int alen;
DPRINT(DEBUG_CALLS, output_debug_level,
("* output_krb5_errmsg(v=%d, lang=%s, mime=%d)\n",