diff options
author | markm <markm@FreeBSD.org> | 2000-01-09 08:31:47 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-01-09 08:31:47 +0000 |
commit | ca616c603d9e06e51c9e23fab7536acbdac58331 (patch) | |
tree | 20a735799ecd3b90df122d0a8042762dd62c6b0e /crypto/kerberosIV/admin | |
parent | fe83e8abf357ee11114856a5278bb38431a9517c (diff) | |
download | FreeBSD-src-ca616c603d9e06e51c9e23fab7536acbdac58331.zip FreeBSD-src-ca616c603d9e06e51c9e23fab7536acbdac58331.tar.gz |
Clean import of KTH Kerberos (eBones) v1.0.
Diffstat (limited to 'crypto/kerberosIV/admin')
-rw-r--r-- | crypto/kerberosIV/admin/adm_locl.h | 9 | ||||
-rw-r--r-- | crypto/kerberosIV/admin/ext_srvtab.c | 4 | ||||
-rw-r--r-- | crypto/kerberosIV/admin/kdb_edit.c | 6 | ||||
-rw-r--r-- | crypto/kerberosIV/admin/kdb_init.c | 16 | ||||
-rw-r--r-- | crypto/kerberosIV/admin/kdb_util.c | 20 |
5 files changed, 32 insertions, 23 deletions
diff --git a/crypto/kerberosIV/admin/adm_locl.h b/crypto/kerberosIV/admin/adm_locl.h index 6cbd20d..9a41b4b 100644 --- a/crypto/kerberosIV/admin/adm_locl.h +++ b/crypto/kerberosIV/admin/adm_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: adm_locl.h,v 1.16 1997/04/20 05:46:14 assar Exp $ */ +/* $Id: adm_locl.h,v 1.17 1999/12/02 16:58:27 joda Exp $ */ #ifndef __adm_locl_h #define __adm_locl_h diff --git a/crypto/kerberosIV/admin/ext_srvtab.c b/crypto/kerberosIV/admin/ext_srvtab.c index f1f1752..5cab583 100644 --- a/crypto/kerberosIV/admin/ext_srvtab.c +++ b/crypto/kerberosIV/admin/ext_srvtab.c @@ -9,7 +9,7 @@ #include "adm_locl.h" -RCSID("$Id: ext_srvtab.c,v 1.17 1998/06/09 19:24:13 joda Exp $"); +RCSID("$Id: ext_srvtab.c,v 1.18 1999/09/16 20:37:20 assar Exp $"); static des_cblock master_key; static des_cblock session_key; @@ -73,7 +73,7 @@ main(int argc, char **argv) if (++i >= argc) usage(); else { - strcpy_truncate(realm, argv[i], REALM_SZ); + strlcpy(realm, argv[i], REALM_SZ); /* * This is to humor the broken way commandline * argument parsing is done. Later, this diff --git a/crypto/kerberosIV/admin/kdb_edit.c b/crypto/kerberosIV/admin/kdb_edit.c index bd9df2d..1ba6aaf 100644 --- a/crypto/kerberosIV/admin/kdb_edit.c +++ b/crypto/kerberosIV/admin/kdb_edit.c @@ -15,7 +15,7 @@ #include "adm_locl.h" -RCSID("$Id: kdb_edit.c,v 1.27 1998/11/22 09:26:31 assar Exp $"); +RCSID("$Id: kdb_edit.c,v 1.28 1999/09/16 20:37:21 assar Exp $"); #ifdef DEBUG extern kerb_debug; @@ -93,10 +93,10 @@ change_principal(void) /* make a new principal, fill in defaults */ j = 1; creating = 1; - strcpy_truncate(principal_data[0].name, + strlcpy(principal_data[0].name, input_name, ANAME_SZ); - strcpy_truncate(principal_data[0].instance, + strlcpy(principal_data[0].instance, input_instance, INST_SZ); principal_data[0].old = NULL; diff --git a/crypto/kerberosIV/admin/kdb_init.c b/crypto/kerberosIV/admin/kdb_init.c index bf340a7..0116ea2 100644 --- a/crypto/kerberosIV/admin/kdb_init.c +++ b/crypto/kerberosIV/admin/kdb_init.c @@ -10,7 +10,7 @@ #include "adm_locl.h" -RCSID("$Id: kdb_init.c,v 1.24 1998/06/09 19:24:13 joda Exp $"); +RCSID("$Id: kdb_init.c,v 1.25 1999/09/16 20:37:21 assar Exp $"); enum ap_op { NULL_KEY, /* setup null keys */ @@ -31,8 +31,8 @@ add_principal(char *name, char *instance, enum ap_op aap_op, int maxlife) des_cblock new_key; memset(&principal, 0, sizeof(principal)); - strcpy_truncate(principal.name, name, ANAME_SZ); - strcpy_truncate(principal.instance, instance, INST_SZ); + strlcpy(principal.name, name, ANAME_SZ); + strlcpy(principal.instance, instance, INST_SZ); switch (aap_op) { case NULL_KEY: principal.key_low = 0; @@ -68,8 +68,8 @@ add_principal(char *name, char *instance, enum ap_op aap_op, int maxlife) principal.kdc_key_ver = 1; principal.key_version = 1; - strcpy_truncate(principal.mod_name, "db_creation", ANAME_SZ); - strcpy_truncate(principal.mod_instance, "", INST_SZ); + strlcpy(principal.mod_name, "db_creation", ANAME_SZ); + strlcpy(principal.mod_instance, "", INST_SZ); principal.old = 0; if (kerb_db_put_principal(&principal, 1) != 1) @@ -108,10 +108,10 @@ main(int argc, char **argv) kerb_db_set_name(database); if (argc == 2) - strcpy_truncate(realm, argv[1], REALM_SZ); + strlcpy(realm, argv[1], REALM_SZ); else { if (krb_get_lrealm(realm, 1) != KSUCCESS) - strcpy_truncate(realm, KRB_REALM, REALM_SZ); + strlcpy(realm, KRB_REALM, REALM_SZ); fprintf(stderr, "Realm name [default %s ]: ", realm); if (fgets(realm, sizeof(realm), stdin) == NULL) errx (1, "\nEOF reading realm"); @@ -119,7 +119,7 @@ main(int argc, char **argv) *cp = '\0'; if (!*realm) /* no realm given */ if (krb_get_lrealm(realm, 1) != KSUCCESS) - strcpy_truncate(realm, KRB_REALM, REALM_SZ); + strlcpy(realm, KRB_REALM, REALM_SZ); } if (!k_isrealm(realm)) errx (1, "Bad kerberos realm name \"%s\"", realm); diff --git a/crypto/kerberosIV/admin/kdb_util.c b/crypto/kerberosIV/admin/kdb_util.c index 4700df1..cff031c 100644 --- a/crypto/kerberosIV/admin/kdb_util.c +++ b/crypto/kerberosIV/admin/kdb_util.c @@ -15,7 +15,7 @@ #include "adm_locl.h" -RCSID("$Id: kdb_util.c,v 1.40 1999/07/05 21:43:52 assar Exp $"); +RCSID("$Id: kdb_util.c,v 1.42 1999/09/16 20:37:21 assar Exp $"); static des_cblock master_key, new_master_key; static des_key_schedule master_key_schedule, new_master_key_schedule; @@ -53,7 +53,7 @@ time_explode(char *cp) memset(&tp, 0, sizeof(tp)); /* clear out the struct */ if (strlen(cp) > 10) { /* new format */ - strcpy_truncate(wbuf, cp, sizeof(wbuf)); + strlcpy(wbuf, cp, sizeof(wbuf)); tp.tm_year = atoi(wbuf) - 1900; cp += 4; /* step over the year */ local = 0; /* GMT */ @@ -432,6 +432,7 @@ main(int argc, char **argv) fprintf(stderr, "Operation is one of: " "load, merge, dump, slave_dump, new_master_key, " "convert_old_db\n"); + fprintf(stderr, "use file `-' for stdout\n"); exit(1); } if (argc == 3) @@ -469,7 +470,20 @@ main(int argc, char **argv) } file_name = argv[2]; - file = fopen(file_name, (op == OP_LOAD || op == OP_MERGE) ? "r" : "w"); + if (strcmp (file_name, "-") == 0 + && op != OP_LOAD + && op != OP_MERGE) + file = stdout; + else { + char *mode; + + if (op == OP_LOAD || op == OP_MERGE) + mode = "r"; + else + mode = "w"; + + file = fopen (file_name, mode); + } if (file == NULL) err (1, "open %s", argv[2]); |