summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/kadmin
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/kerberosIV/kadmin')
-rw-r--r--crypto/kerberosIV/kadmin/admin_server.c6
-rw-r--r--crypto/kerberosIV/kadmin/kadm_funcs.c40
-rw-r--r--crypto/kerberosIV/kadmin/kadm_locl.h9
-rw-r--r--crypto/kerberosIV/kadmin/kadm_ser_wrap.c8
-rw-r--r--crypto/kerberosIV/kadmin/kadmin.c24
-rw-r--r--crypto/kerberosIV/kadmin/kpasswd.c24
-rw-r--r--crypto/kerberosIV/kadmin/ksrvutil.c39
-rw-r--r--crypto/kerberosIV/kadmin/ksrvutil.h9
-rw-r--r--crypto/kerberosIV/kadmin/ksrvutil_get.c55
-rw-r--r--crypto/kerberosIV/kadmin/new_pwd.c9
-rw-r--r--crypto/kerberosIV/kadmin/pw_check.c9
-rw-r--r--crypto/kerberosIV/kadmin/pw_check.h9
-rw-r--r--crypto/kerberosIV/kadmin/random_password.c11
13 files changed, 111 insertions, 141 deletions
diff --git a/crypto/kerberosIV/kadmin/admin_server.c b/crypto/kerberosIV/kadmin/admin_server.c
index 6421ac6..c1f2a8e 100644
--- a/crypto/kerberosIV/kadmin/admin_server.c
+++ b/crypto/kerberosIV/kadmin/admin_server.c
@@ -30,7 +30,7 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: admin_server.c,v 1.47 1999/07/07 12:41:07 assar Exp $");
+RCSID("$Id: admin_server.c,v 1.49 1999/11/13 06:32:19 assar Exp $");
/* Almost all procs and such need this, so it is global */
admin_params prm; /* The command line parameters struct */
@@ -388,7 +388,7 @@ main(int argc, char **argv) /* admin_server main routine */
memset(krbrlm, 0, sizeof(krbrlm));
- while ((c = getopt(argc, argv, "f:hmnd:a:r:i:")) != EOF)
+ while ((c = getopt(argc, argv, "f:hmnd:a:r:i:")) != -1)
switch(c) {
case 'f': /* Syslog file name change */
prm.sysfile = optarg;
@@ -409,7 +409,7 @@ main(int argc, char **argv) /* admin_server main routine */
optarg, error_message(errval));
break;
case 'r':
- strcpy_truncate (krbrlm, optarg, sizeof(krbrlm));
+ strlcpy (krbrlm, optarg, sizeof(krbrlm));
break;
case 'i':
/* Only listen on this address */
diff --git a/crypto/kerberosIV/kadmin/kadm_funcs.c b/crypto/kerberosIV/kadmin/kadm_funcs.c
index 378d0d7..8ae8a41 100644
--- a/crypto/kerberosIV/kadmin/kadm_funcs.c
+++ b/crypto/kerberosIV/kadmin/kadm_funcs.c
@@ -30,7 +30,7 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: kadm_funcs.c,v 1.17 1998/06/09 19:24:53 joda Exp $");
+RCSID("$Id: kadm_funcs.c,v 1.18 1999/09/16 20:41:40 assar Exp $");
static int
check_access(char *pname, char *pinst, char *prealm, enum acl_types acltype)
@@ -94,10 +94,10 @@ kadm_add_entry (char *rname, char *rinstance, char *rrealm,
char admin[MAX_K_NAME_SZ], victim[MAX_K_NAME_SZ];
- strcpy_truncate(admin,
+ strlcpy(admin,
krb_unparse_name_long(rname, rinstance, rrealm),
sizeof(admin));
- strcpy_truncate(victim,
+ strlcpy(victim,
krb_unparse_name_long(valsin->name,
valsin->instance,
NULL),
@@ -124,8 +124,8 @@ kadm_add_entry (char *rname, char *rinstance, char *rrealm,
}
kadm_vals_to_prin(valsin->fields, &data_i, valsin);
- strcpy_truncate(data_i.name, valsin->name, ANAME_SZ);
- strcpy_truncate(data_i.instance, valsin->instance, INST_SZ);
+ strlcpy(data_i.name, valsin->name, ANAME_SZ);
+ strlcpy(data_i.instance, valsin->instance, INST_SZ);
if (!IS_FIELD(KADM_EXPDATE,valsin->fields))
data_i.exp_date = default_princ.exp_date;
@@ -159,8 +159,8 @@ kadm_add_entry (char *rname, char *rinstance, char *rrealm,
} else {
data_i.key_version++;
data_i.kdc_key_ver = server_parm.master_key_version;
- strcpy_truncate(data_i.mod_name, rname, sizeof(data_i.mod_name));
- strcpy_truncate(data_i.mod_instance, rinstance,
+ strlcpy(data_i.mod_name, rname, sizeof(data_i.mod_name));
+ strlcpy(data_i.mod_instance, rinstance,
sizeof(data_i.mod_instance));
numfound = kerb_put_principal(&data_i, 1);
@@ -195,10 +195,10 @@ kadm_delete_entry (char *rname, char *rinstance, char *rrealm,
char admin[MAX_K_NAME_SZ], victim[MAX_K_NAME_SZ];
- strcpy_truncate(admin,
+ strlcpy(admin,
krb_unparse_name_long(rname, rinstance, rrealm),
sizeof(admin));
- strcpy_truncate(victim,
+ strlcpy(victim,
krb_unparse_name_long(valsin->name,
valsin->instance,
NULL),
@@ -244,10 +244,10 @@ kadm_get_entry (char *rname, char *rinstance, char *rrealm,
char admin[MAX_K_NAME_SZ], victim[MAX_K_NAME_SZ];
- strcpy_truncate(admin,
+ strlcpy(admin,
krb_unparse_name_long(rname, rinstance, rrealm),
sizeof(admin));
- strcpy_truncate(victim,
+ strlcpy(victim,
krb_unparse_name_long(valsin->name,
valsin->instance,
NULL),
@@ -290,10 +290,10 @@ kadm_mod_entry (char *rname, char *rinstance, char *rrealm,
char admin[MAX_K_NAME_SZ], victim[MAX_K_NAME_SZ];
- strcpy_truncate(admin,
+ strlcpy(admin,
krb_unparse_name_long(rname, rinstance, rrealm),
sizeof(admin));
- strcpy_truncate(victim,
+ strlcpy(victim,
krb_unparse_name_long(valsin->name,
valsin->instance,
NULL),
@@ -316,8 +316,8 @@ kadm_mod_entry (char *rname, char *rinstance, char *rrealm,
failmod(KADM_DB_INUSE);
} else if (numfound) {
kadm_vals_to_prin(valsin2->fields, &temp_key, valsin2);
- strcpy_truncate(data_o.name, valsin->name, ANAME_SZ);
- strcpy_truncate(data_o.instance, valsin->instance, INST_SZ);
+ strlcpy(data_o.name, valsin->name, ANAME_SZ);
+ strlcpy(data_o.instance, valsin->instance, INST_SZ);
if (IS_FIELD(KADM_EXPDATE,valsin2->fields))
data_o.exp_date = temp_key.exp_date;
if (IS_FIELD(KADM_ATTR,valsin2->fields))
@@ -344,8 +344,8 @@ kadm_mod_entry (char *rname, char *rinstance, char *rrealm,
}
memset(&temp_key, 0, sizeof(temp_key));
- strcpy_truncate(data_o.mod_name, rname, sizeof(data_o.mod_name));
- strcpy_truncate(data_o.mod_instance, rinstance,
+ strlcpy(data_o.mod_name, rname, sizeof(data_o.mod_name));
+ strlcpy(data_o.mod_instance, rinstance,
sizeof(data_o.mod_instance));
more = kerb_put_principal(&data_o, 1);
@@ -387,7 +387,7 @@ kadm_change (char *rname, char *rinstance, char *rrealm, unsigned char *newpw)
char admin[MAX_K_NAME_SZ];
- strcpy_truncate(admin,
+ strlcpy(admin,
krb_unparse_name_long(rname, rinstance, rrealm),
sizeof(admin));
@@ -416,8 +416,8 @@ kadm_change (char *rname, char *rinstance, char *rrealm, unsigned char *newpw)
copy_from_key(local_pw, &data_o.key_low, &data_o.key_high);
data_o.key_version++;
data_o.kdc_key_ver = server_parm.master_key_version;
- strcpy_truncate(data_o.mod_name, rname, sizeof(data_o.mod_name));
- strcpy_truncate(data_o.mod_instance, rinstance,
+ strlcpy(data_o.mod_name, rname, sizeof(data_o.mod_name));
+ strlcpy(data_o.mod_instance, rinstance,
sizeof(data_o.mod_instance));
more = kerb_put_principal(&data_o, 1);
memset(local_pw, 0, sizeof(local_pw));
diff --git a/crypto/kerberosIV/kadmin/kadm_locl.h b/crypto/kerberosIV/kadmin/kadm_locl.h
index 44708d9..960c564 100644
--- a/crypto/kerberosIV/kadmin/kadm_locl.h
+++ b/crypto/kerberosIV/kadmin/kadm_locl.h
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -36,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: kadm_locl.h,v 1.30 1998/11/18 19:44:05 assar Exp $ */
+/* $Id: kadm_locl.h,v 1.31 1999/12/02 16:58:36 joda Exp $ */
#include "config.h"
#include "protos.h"
diff --git a/crypto/kerberosIV/kadmin/kadm_ser_wrap.c b/crypto/kerberosIV/kadmin/kadm_ser_wrap.c
index c95af04..196a89c 100644
--- a/crypto/kerberosIV/kadmin/kadm_ser_wrap.c
+++ b/crypto/kerberosIV/kadmin/kadm_ser_wrap.c
@@ -30,7 +30,7 @@ unwraps wrapped packets and calls the appropriate server subroutine
#include "kadm_locl.h"
-RCSID("$Id: kadm_ser_wrap.c,v 1.24 1998/06/13 00:45:52 assar Exp $");
+RCSID("$Id: kadm_ser_wrap.c,v 1.25 1999/09/16 20:41:41 assar Exp $");
/* GLOBAL */
Kadm_Server server_parm;
@@ -52,13 +52,13 @@ kadm_ser_init(int inter, /* interactive or from file */
if (gethostname(hostname, sizeof(hostname)))
return KADM_NO_HOSTNAME;
- strcpy_truncate(server_parm.sname,
+ strlcpy(server_parm.sname,
PWSERV_NAME,
sizeof(server_parm.sname));
- strcpy_truncate(server_parm.sinst,
+ strlcpy(server_parm.sinst,
KRB_MASTER,
sizeof(server_parm.sinst));
- strcpy_truncate(server_parm.krbrlm,
+ strlcpy(server_parm.krbrlm,
realm,
sizeof(server_parm.krbrlm));
diff --git a/crypto/kerberosIV/kadmin/kadmin.c b/crypto/kerberosIV/kadmin/kadmin.c
index 340a914..76abda5 100644
--- a/crypto/kerberosIV/kadmin/kadmin.c
+++ b/crypto/kerberosIV/kadmin/kadmin.c
@@ -31,7 +31,7 @@ or implied warranty.
#include "getarg.h"
#include "parse_time.h"
-RCSID("$Id: kadmin.c,v 1.59.2.1 1999/09/02 08:51:59 joda Exp $");
+RCSID("$Id: kadmin.c,v 1.62 1999/11/02 17:02:14 bg Exp $");
static int change_password(int argc, char **argv);
static int change_key(int argc, char **argv);
@@ -390,7 +390,7 @@ do_init(int argc, char **argv)
if(ret < 0)
errx(1, "Can't figure out default principal");
if(pr.instance[0] == '\0')
- strcpy_truncate(pr.instance, "admin", sizeof(pr.instance));
+ strlcpy(pr.instance, "admin", sizeof(pr.instance));
if(principal) {
if(username)
warnx("Ignoring username when principal is given");
@@ -398,19 +398,19 @@ do_init(int argc, char **argv)
if(ret)
errx(1, "%s: %s", principal, krb_get_err_text(ret));
if(pr.realm[0] != '\0')
- strcpy_truncate(default_realm, pr.realm, sizeof(default_realm));
+ strlcpy(default_realm, pr.realm, sizeof(default_realm));
} else if(username) {
- strcpy_truncate(pr.name, username, sizeof(pr.name));
- strcpy_truncate(pr.instance, "admin", sizeof(pr.instance));
+ strlcpy(pr.name, username, sizeof(pr.name));
+ strlcpy(pr.instance, "admin", sizeof(pr.instance));
}
if(realm)
- strcpy_truncate(default_realm, realm, sizeof(default_realm));
+ strlcpy(default_realm, realm, sizeof(default_realm));
- strcpy_truncate(krbrlm, default_realm, sizeof(krbrlm));
+ strlcpy(krbrlm, default_realm, sizeof(krbrlm));
if(pr.realm[0] == '\0')
- strcpy_truncate(pr.realm, krbrlm, sizeof(pr.realm));
+ strlcpy(pr.realm, krbrlm, sizeof(pr.realm));
if (kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm) != KADM_SUCCESS)
*krbrlm = '\0';
@@ -425,8 +425,8 @@ do_init(int argc, char **argv)
destroy_timeout = 0; /* disable timeout */
else{
char tktstring[128];
- snprintf(tktstring, sizeof(tktstring),
- TKT_ROOT "_adm_%d",(int)getpid());
+ snprintf(tktstring, sizeof(tktstring), "%s_adm_%d",
+ TKT_ROOT, (int)getpid());
krb_set_tkt_string(tktstring);
}
return optind;
@@ -471,9 +471,9 @@ setvals(Kadm_vals *vals, char *string)
return status;
}
if (!realm[0])
- strcpy_truncate(realm, default_realm, sizeof(realm));
+ strlcpy(realm, default_realm, sizeof(realm));
if (strcmp(realm, krbrlm)) {
- strcpy_truncate(krbrlm, realm, sizeof(krbrlm));
+ strlcpy(krbrlm, realm, sizeof(krbrlm));
if ((status = kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm))
!= KADM_SUCCESS)
printf("kadm error for realm %s: %s\n",
diff --git a/crypto/kerberosIV/kadmin/kpasswd.c b/crypto/kerberosIV/kadmin/kpasswd.c
index f32946b..d0d35be 100644
--- a/crypto/kerberosIV/kadmin/kpasswd.c
+++ b/crypto/kerberosIV/kadmin/kpasswd.c
@@ -25,7 +25,7 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: kpasswd.c,v 1.26 1998/06/09 19:24:54 joda Exp $");
+RCSID("$Id: kpasswd.c,v 1.29 1999/11/13 06:33:20 assar Exp $");
static void
usage(int value)
@@ -57,7 +57,7 @@ main(int argc, char **argv)
default_principal.instance,
default_principal.realm);
- while ((c = getopt(argc, argv, "u:n:i:r:h")) != EOF) {
+ while ((c = getopt(argc, argv, "u:n:i:r:h")) != -1) {
switch (c) {
case 'u':
status = krb_parse_name (optarg, &principal);
@@ -70,7 +70,7 @@ main(int argc, char **argv)
break;
case 'n':
if (k_isname(optarg))
- strcpy_truncate(principal.name,
+ strlcpy(principal.name,
optarg,
sizeof(principal.name));
else {
@@ -80,7 +80,7 @@ main(int argc, char **argv)
break;
case 'i':
if (k_isinst(optarg))
- strcpy_truncate(principal.instance,
+ strlcpy(principal.instance,
optarg,
sizeof(principal.instance));
else {
@@ -90,7 +90,7 @@ main(int argc, char **argv)
break;
case 'r':
if (k_isrealm(optarg)) {
- strcpy_truncate(principal.realm,
+ strlcpy(principal.realm,
optarg,
sizeof(principal.realm));
realm_given++;
@@ -116,28 +116,28 @@ main(int argc, char **argv)
}
if (use_default) {
- strcpy_truncate(principal.name,
+ strlcpy(principal.name,
default_principal.name,
sizeof(principal.name));
- strcpy_truncate(principal.instance,
+ strlcpy(principal.instance,
default_principal.instance,
sizeof(principal.instance));
- strcpy_truncate(principal.realm,
+ strlcpy(principal.realm,
default_principal.realm,
sizeof(principal.realm));
} else {
if (!principal.name[0])
- strcpy_truncate(principal.name,
+ strlcpy(principal.name,
default_principal.name,
sizeof(principal.name));
if (!principal.realm[0])
- strcpy_truncate(principal.realm,
+ strlcpy(principal.realm,
default_principal.realm,
sizeof(principal.realm));
}
- snprintf(tktstring, sizeof(tktstring),
- TKT_ROOT "_cpw_%u", (unsigned)getpid());
+ snprintf(tktstring, sizeof(tktstring), "%s_cpw_%u",
+ TKT_ROOT, (unsigned)getpid());
krb_set_tkt_string(tktstring);
if (get_pw_new_pwd(pword, sizeof(pword), &principal,
diff --git a/crypto/kerberosIV/kadmin/ksrvutil.c b/crypto/kerberosIV/kadmin/ksrvutil.c
index 8f75d52..38722a0 100644
--- a/crypto/kerberosIV/kadmin/ksrvutil.c
+++ b/crypto/kerberosIV/kadmin/ksrvutil.c
@@ -30,7 +30,7 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: ksrvutil.c,v 1.47 1999/06/29 18:53:58 bg Exp $");
+RCSID("$Id: ksrvutil.c,v 1.50 1999/11/13 06:33:59 assar Exp $");
#include "ksrvutil.h"
@@ -322,11 +322,11 @@ main(int argc, char **argv)
/* This is used only as a default for adding keys */
if (krb_get_lrealm(local_realm, 1) != KSUCCESS)
- strcpy_truncate(local_realm,
+ strlcpy(local_realm,
KRB_REALM,
sizeof(local_realm));
- while((c = getopt(argc, argv, "ikc:f:p:r:u")) != EOF) {
+ while((c = getopt(argc, argv, "ikc:f:p:r:u")) != -1) {
switch (c) {
case 'i':
interactive++;
@@ -335,10 +335,10 @@ main(int argc, char **argv)
key++;
break;
case 'c':
- strcpy_truncate(cellname, optarg, sizeof(cellname));
+ strlcpy(cellname, optarg, sizeof(cellname));
break;
case 'f':
- strcpy_truncate(keyfile, optarg, sizeof(keyfile));
+ strlcpy(keyfile, optarg, sizeof(keyfile));
break;
case 'p':
if((status = kname_parse (u_name, u_inst, u_realm, optarg)) !=
@@ -347,7 +347,7 @@ main(int argc, char **argv)
krb_get_err_text(status));
break;
case 'r':
- strcpy_truncate(u_realm, optarg, sizeof(u_realm));
+ strlcpy(u_realm, optarg, sizeof(u_realm));
break;
case 'u':
unique_filename = 1;
@@ -359,7 +359,7 @@ main(int argc, char **argv)
if (optind >= argc)
usage();
if (*u_realm == '\0')
- strcpy_truncate (u_realm, local_realm, sizeof(u_realm));
+ strlcpy (u_realm, local_realm, sizeof(u_realm));
if (strcmp(argv[optind], "list") == 0) {
if (arg_entered)
usage();
@@ -411,10 +411,10 @@ main(int argc, char **argv)
warnx("`-u' flag is only used with `get'");
if (!keyfile[0])
- strcpy_truncate(keyfile, KEYFILE, sizeof(keyfile));
+ strlcpy(keyfile, KEYFILE, sizeof(keyfile));
- strcpy_truncate(work_keyfile, keyfile, sizeof(work_keyfile));
- strcpy_truncate(backup_keyfile, keyfile, sizeof(backup_keyfile));
+ strlcpy(work_keyfile, keyfile, sizeof(work_keyfile));
+ strlcpy(backup_keyfile, keyfile, sizeof(backup_keyfile));
if (change || add || (get && !unique_filename) || delete) {
snprintf(work_keyfile, sizeof(work_keyfile), "%s.work", keyfile);
@@ -475,9 +475,8 @@ main(int argc, char **argv)
printf("\n");
}
else if (change) {
- snprintf(change_tkt, sizeof(change_tkt),
- TKT_ROOT "_ksrvutil.%u",
- (unsigned)getpid());
+ snprintf(change_tkt, sizeof(change_tkt), "%s_ksrvutil.%u",
+ TKT_ROOT, (unsigned)getpid());
krb_set_tkt_string(change_tkt);
destroyp = TRUE;
@@ -584,24 +583,24 @@ main(int argc, char **argv)
p = strchr(databuf, '.');
if (p != NULL) {
*p++ = '\0';
- strcpy_truncate (sname, databuf, sizeof(sname));
- strcpy_truncate (sinst, p, sizeof(sinst));
+ strlcpy (sname, databuf, sizeof(sname));
+ strlcpy (sinst, p, sizeof(sinst));
} else {
- strcpy_truncate (sname, databuf, sizeof(sname));
+ strlcpy (sname, databuf, sizeof(sname));
safe_read_stdin("Instance: ", databuf, sizeof(databuf));
- strcpy_truncate (sinst, databuf, sizeof(databuf));
+ strlcpy (sinst, databuf, sizeof(databuf));
}
safe_read_stdin("Realm: ", databuf, sizeof(databuf));
if (databuf[0] != '\0')
- strcpy_truncate (srealm, databuf, sizeof(srealm));
+ strlcpy (srealm, databuf, sizeof(srealm));
else
- strcpy_truncate (srealm, local_realm, sizeof(srealm));
+ strlcpy (srealm, local_realm, sizeof(srealm));
safe_read_stdin("Version number: ", databuf, sizeof(databuf));
key_vno = atoi(databuf);
if (!srealm[0])
- strcpy_truncate(srealm, local_realm, sizeof(srealm));
+ strlcpy(srealm, local_realm, sizeof(srealm));
printf("New principal: ");
print_name(sname, sinst, srealm);
printf("; version %d\n", key_vno);
diff --git a/crypto/kerberosIV/kadmin/ksrvutil.h b/crypto/kerberosIV/kadmin/ksrvutil.h
index b548fc7..2b562ac 100644
--- a/crypto/kerberosIV/kadmin/ksrvutil.h
+++ b/crypto/kerberosIV/kadmin/ksrvutil.h
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +32,7 @@
*/
/*
- * $Id: ksrvutil.h,v 1.9 1998/01/16 19:01:31 joda Exp $
+ * $Id: ksrvutil.h,v 1.10 1999/12/02 16:58:36 joda Exp $
*
*/
diff --git a/crypto/kerberosIV/kadmin/ksrvutil_get.c b/crypto/kerberosIV/kadmin/ksrvutil_get.c
index a9c0797..a08b10d 100644
--- a/crypto/kerberosIV/kadmin/ksrvutil_get.c
+++ b/crypto/kerberosIV/kadmin/ksrvutil_get.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -39,7 +34,7 @@
#include "kadm_locl.h"
#include "ksrvutil.h"
-RCSID("$Id: ksrvutil_get.c,v 1.38 1999/06/29 21:19:37 bg Exp $");
+RCSID("$Id: ksrvutil_get.c,v 1.43 1999/12/02 16:58:36 joda Exp $");
#define BAD_PW 1
#define GOOD_PW 0
@@ -186,15 +181,15 @@ get_srvtab_ent(int unique_filename, int fd, char *filename,
Kadm_vals values;
int ret;
- strcpy_truncate(chname, krb_get_phost(inst), sizeof(chname));
+ strlcpy(chname, krb_get_phost(inst), sizeof(chname));
if(strcmp(inst, chname))
fprintf(stderr,
"Warning: Are you sure `%s' should not be `%s'?\n",
inst, chname);
memset(&values, 0, sizeof(values));
- strcpy_truncate(values.name, name, sizeof(values.name));
- strcpy_truncate(values.instance, inst, sizeof(values.instance));
+ strlcpy(values.name, name, sizeof(values.name));
+ strlcpy(values.instance, inst, sizeof(values.instance));
des_new_random_key(&newkey);
values.key_low = (newkey[0] << 24) | (newkey[1] << 16)
| (newkey[2] << 8) | (newkey[3] << 0);
@@ -220,15 +215,20 @@ get_srvtab_ent(int unique_filename, int fd, char *filename,
{
int old = krb_use_admin_server(1);
- strcpy_truncate(old_tktfile, tkt_string(), sizeof(old_tktfile));
- snprintf(new_tktfile, sizeof(new_tktfile),
- TKT_ROOT "_ksrvutil-get.%u",
- (unsigned)getpid());
+ strlcpy(old_tktfile, tkt_string(), sizeof(old_tktfile));
+ snprintf(new_tktfile, sizeof(new_tktfile), "%s_ksrvutil-get.%u",
+ TKT_ROOT, (unsigned)getpid());
krb_set_tkt_string(new_tktfile);
ret = krb_get_in_tkt(name, inst, realm, name, inst,
1, key_to_key, NULL, &newkey);
krb_use_admin_server(old);
+ if (ret) {
+ warnx ("getting tickets for %s: %s",
+ krb_unparse_name_long(name, inst, realm),
+ krb_get_err_text(ret));
+ return;
+ }
}
if (ret == KSUCCESS &&
@@ -238,7 +238,8 @@ get_srvtab_ent(int unique_filename, int fd, char *filename,
(ret = tf_get_cred(&c)) == KSUCCESS)
kvno = c.kvno;
else {
- warnx ("Could not find the cred in the ticket file");
+ warnx ("Could not find the cred in the ticket file: %s",
+ krb_get_err_text(ret));
return;
}
@@ -302,8 +303,8 @@ ksrvutil_kadm(int unique_filename, int fd, char *filename, struct srv_ent *p)
/*
* create ticket file and get admin tickets
*/
- snprintf(tktstring, sizeof(tktstring),
- TKT_ROOT "_ksrvutil_%d", (int)getpid());
+ snprintf(tktstring, sizeof(tktstring), "%s_ksrvutil_%d",
+ TKT_ROOT, (int)getpid());
krb_set_tkt_string(tktstring);
destroyp = TRUE;
@@ -327,7 +328,7 @@ parseinput (char *result, size_t sz, char *val, char *def)
int inq;
if (val[0] == '\0') {
- strcpy_truncate (result, def, sz);
+ strlcpy (result, def, sz);
return;
}
lim = result + sz - 1;
@@ -362,7 +363,7 @@ ksrvutil_get(int unique_filename, int fd, char *filename, int argc, char **argv)
int i;
gethostname(local_hostname, sizeof(local_hostname));
- strcpy_truncate(local_hostname,
+ strlcpy(local_hostname,
krb_get_phost(local_hostname),
sizeof(local_hostname));
@@ -375,7 +376,7 @@ ksrvutil_get(int unique_filename, int fd, char *filename, int argc, char **argv)
leave(NULL,1);
}
p->next = head;
- strcpy_truncate (p->realm, u_realm, sizeof(p->realm));
+ strlcpy (p->realm, u_realm, sizeof(p->realm));
if (kname_parse (p->name, p->inst, p->realm, argv[i]) !=
KSUCCESS) {
warnx ("parse error on '%s'\n", argv[i]);
@@ -383,11 +384,11 @@ ksrvutil_get(int unique_filename, int fd, char *filename, int argc, char **argv)
continue;
}
if (p->name[0] == '\0')
- strcpy_truncate(p->name, "rcmd", sizeof(p->name));
+ strlcpy(p->name, "rcmd", sizeof(p->name));
if (p->inst[0] == '\0')
- strcpy_truncate(p->inst, local_hostname, sizeof(p->inst));
+ strlcpy(p->inst, local_hostname, sizeof(p->inst));
if (p->realm[0] == '\0')
- strcpy_truncate(p->realm, u_realm, sizeof(p->realm));
+ strlcpy(p->realm, u_realm, sizeof(p->realm));
head = p;
}
@@ -412,9 +413,9 @@ ksrvutil_get(int unique_filename, int fd, char *filename, int argc, char **argv)
}
p->next=head;
head=p;
- strcpy_truncate(p->name, sname, sizeof(p->name));
- strcpy_truncate(p->inst, sinst, sizeof(p->inst));
- strcpy_truncate(p->realm, srealm, sizeof(p->realm));
+ strlcpy(p->name, sname, sizeof(p->name));
+ strlcpy(p->inst, sinst, sizeof(p->inst));
+ strlcpy(p->realm, srealm, sizeof(p->realm));
}
}while(ny("Add more keys?"));
diff --git a/crypto/kerberosIV/kadmin/new_pwd.c b/crypto/kerberosIV/kadmin/new_pwd.c
index 64756f7..cfeb095 100644
--- a/crypto/kerberosIV/kadmin/new_pwd.c
+++ b/crypto/kerberosIV/kadmin/new_pwd.c
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -38,7 +33,7 @@
#include "kadm_locl.h"
-RCSID("$Id: new_pwd.c,v 1.13 1998/06/09 19:24:55 joda Exp $");
+RCSID("$Id: new_pwd.c,v 1.14 1999/12/02 16:58:36 joda Exp $");
#ifdef NOENCRYPTION
#define read_long_pw_string placebo_read_pw_string
diff --git a/crypto/kerberosIV/kadmin/pw_check.c b/crypto/kerberosIV/kadmin/pw_check.c
index ac6912b..448ad37 100644
--- a/crypto/kerberosIV/kadmin/pw_check.c
+++ b/crypto/kerberosIV/kadmin/pw_check.c
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -38,7 +33,7 @@
#include "kadm_locl.h"
-RCSID("$Id: pw_check.c,v 1.13 1997/04/01 08:17:50 joda Exp $");
+RCSID("$Id: pw_check.c,v 1.14 1999/12/02 16:58:36 joda Exp $");
/*
* kadm_pw_check
diff --git a/crypto/kerberosIV/kadmin/pw_check.h b/crypto/kerberosIV/kadmin/pw_check.h
index c5a5d69..8b717f8 100644
--- a/crypto/kerberosIV/kadmin/pw_check.h
+++ b/crypto/kerberosIV/kadmin/pw_check.h
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +32,7 @@
*/
/*
- * $Id: pw_check.h,v 1.6 1997/04/01 08:17:50 joda Exp $
+ * $Id: pw_check.h,v 1.7 1999/12/02 16:58:36 joda Exp $
*/
int kadm_pw_check(char *pw, des_cblock *newkey,
diff --git a/crypto/kerberosIV/kadmin/random_password.c b/crypto/kerberosIV/kadmin/random_password.c
index d274831..ec8309e 100644
--- a/crypto/kerberosIV/kadmin/random_password.c
+++ b/crypto/kerberosIV/kadmin/random_password.c
@@ -14,12 +14,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. Neither the name of the Institute nor the names of its contributors
+ * 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -38,7 +33,7 @@
#include "kadm_locl.h"
-RCSID("$Id: random_password.c,v 1.2 1998/06/09 19:24:56 joda Exp $");
+RCSID("$Id: random_password.c,v 1.4 1999/12/02 16:58:36 joda Exp $");
/* This file defines some a function that generates a random password,
that can be used when creating a large amount of principals (such
@@ -71,7 +66,7 @@ random_password(char *pw, size_t len, u_int32_t *low, u_int32_t *high)
"abcdefghijklmnopqrstuvwxyz", 7,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", 2,
"@$%&*()-+=:,/<>1234567890", 1);
- strcpy_truncate(pw, pass, len);
+ strlcpy(pw, pass, len);
memset(pass, 0, strlen(pass));
free(pass);
#endif
OpenPOWER on IntegriCloud