From 71aed2a746cd91105068a03ddddd3fb2ad547ab8 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 17 Aug 1993 03:58:24 +0000 Subject: [PATCH] Cleaned up TGTNAME define; now KRB5_TGS_NAME git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2632 dc483132-0cff-0310-8789-dd5450dbe970 --- src/admin/convert/kdb5_convert.c | 2 +- src/admin/create/kdb5_create.c | 2 +- src/appl/bsd/forward.c | 5 ++--- src/appl/telnet/libtelnet/forward.c | 5 ++--- src/clients/kinit/kinit.c | 5 ++--- src/include/krb5/base-defs.h | 8 ++++++-- src/include/krb5/kdb.h | 3 --- src/kadmin/server/adm_extern.c | 2 +- src/kadmin/server/adm_server.c | 2 +- src/lib/krb5/krb/tgtname.c | 3 +-- src/tests/hammer/kdc5_hammer.c | 5 ++--- 11 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/admin/convert/kdb5_convert.c b/src/admin/convert/kdb5_convert.c index 3d5fb094b..fa82da1de 100644 --- a/src/admin/convert/kdb5_convert.c +++ b/src/admin/convert/kdb5_convert.c @@ -124,7 +124,7 @@ krb5_principal master_princ; krb5_encrypt_block master_encblock; krb5_data tgt_princ_entries[] = { - {sizeof(TGTNAME)-1, TGTNAME}, + {KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME}, {0, 0} }; krb5_data db_creator_entries[] = { diff --git a/src/admin/create/kdb5_create.c b/src/admin/create/kdb5_create.c index e7128882d..5a08533de 100644 --- a/src/admin/create/kdb5_create.c +++ b/src/admin/create/kdb5_create.c @@ -97,7 +97,7 @@ krb5_principal master_princ; krb5_encrypt_block master_encblock; krb5_data tgt_princ_entries[] = { - {sizeof(TGTNAME)-1, TGTNAME}, + {KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME}, {0, 0} }; krb5_data db_creator_entries[] = { diff --git a/src/appl/bsd/forward.c b/src/appl/bsd/forward.c index 1e4912997..cdeb87873 100644 --- a/src/appl/bsd/forward.c +++ b/src/appl/bsd/forward.c @@ -41,7 +41,6 @@ static char *rcsid_forward_c = #include #include -#define TGTNAME "krbtgt" /* Else #include */ #define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */ /* helper function: convert flags to necessary KDC options */ #define flags2options(flags) (flags & KDC_TKT_COMMON_MASK) @@ -126,8 +125,8 @@ get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf) if (retval = krb5_build_principal_ext(&creds.server, strlen(hrealms[0]), hrealms[0], - sizeof(TGTNAME) - 1, - TGTNAME, + KRB5_TGS_NAME_SIZE, + KRB5_TGS_NAME, client->realm.length, client->realm.data, 0)) diff --git a/src/appl/telnet/libtelnet/forward.c b/src/appl/telnet/libtelnet/forward.c index 6232ed09e..dcc892774 100644 --- a/src/appl/telnet/libtelnet/forward.c +++ b/src/appl/telnet/libtelnet/forward.c @@ -41,7 +41,6 @@ static char *rcsid_forward_c = #include #include -#define TGTNAME "krbtgt" /* Else #include */ #define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */ /* helper function: convert flags to necessary KDC options */ #define flags2options(flags) (flags & KDC_TKT_COMMON_MASK) @@ -123,8 +122,8 @@ get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf) if (retval = krb5_build_principal_ext(&creds.server, strlen(hrealms[0]), hrealms[0], - sizeof(TGTNAME) - 1, - TGTNAME, + KRB5_TGS_NAME_SIZE, + KRB5_TGS_NAME, client->realm.length, client->realm.data, 0)) diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index a170e6399..7e1c87287 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -35,7 +35,6 @@ static char rcsid_kinit_c [] = #include #include -#include /* for TGTNAME */ #include #include @@ -57,8 +56,8 @@ krb5_parse_lifetime (time, len) } krb5_data tgtname = { - sizeof(TGTNAME)-1, - TGTNAME + KRB5_TGT_NAME_SIZE, + KRB5_TGT_NAME }; /* diff --git a/src/include/krb5/base-defs.h b/src/include/krb5/base-defs.h index 4c6eccae2..433fddecb 100644 --- a/src/include/krb5/base-defs.h +++ b/src/include/krb5/base-defs.h @@ -106,12 +106,12 @@ typedef char const * krb5_const_pointer; typedef struct krb5_principal_data { krb5_data realm; - krb5_data *data; + krb5_data *data; /* An array of strings */ krb5_int32 length; krb5_int32 type; } krb5_principal_data; -typedef krb5_principal_data *krb5_principal; /* array of strings */ +typedef krb5_principal_data *krb5_principal; /* * Per V5 spec on definition of principal types @@ -142,4 +142,8 @@ typedef const krb5_principal_data *krb5_const_principal; #define krb5_princ_name(princ) (princ)->data #define krb5_princ_component(princ,i) ((princ)->data + i) +/* The name of the Kerberos ticket granting service... and its size */ +#define KRB5_TGS_NAME "krbtgt" +#define KRB5_TGS_NAME_SIZE 6 + #endif /* KRB5_BASE_DEFS__ */ diff --git a/src/include/krb5/kdb.h b/src/include/krb5/kdb.h index 3c486a224..23df43f76 100644 --- a/src/include/krb5/kdb.h +++ b/src/include/krb5/kdb.h @@ -188,8 +188,5 @@ krb5_error_code krb5_db_fetch_mkey #define KRB5_KDB_DEF_FLAGS 0 -/* XXX THIS REALLY BELONGS ELSEWHERE */ -#define TGTNAME "krbtgt" - #endif /* KRB5_KDB5__ */ diff --git a/src/kadmin/server/adm_extern.c b/src/kadmin/server/adm_extern.c index 1cdded0a9..d89875abf 100644 --- a/src/kadmin/server/adm_extern.c +++ b/src/kadmin/server/adm_extern.c @@ -59,7 +59,7 @@ int send_seqno; int recv_seqno; /* -static krb5_data tgs_name = {sizeof(TGTNAME)-1, TGTNAME}; +static krb5_data tgs_name = {KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME}; krb5_data *tgs_server[4] = {0, &tgs_name, 0, 0}; */ diff --git a/src/kadmin/server/adm_server.c b/src/kadmin/server/adm_server.c index c61a8dad4..4d6a0e877 100644 --- a/src/kadmin/server/adm_server.c +++ b/src/kadmin/server/adm_server.c @@ -281,7 +281,7 @@ krb5_keyblock *masterkeyblock; the master key name here is from the master_princ global, so we can safely share its substructure */ - strcpy(tgs_name, TGTNAME); + strcpy(tgs_name, KRB5_TGS_NAME); strcat(tgs_name, "/"); strcat(tgs_name, masterkeyname->realm.data); krb5_parse_name(tgs_name, &tgs_server); diff --git a/src/lib/krb5/krb/tgtname.c b/src/lib/krb5/krb/tgtname.c index 8b6b4261c..7748bfb09 100644 --- a/src/lib/krb5/krb/tgtname.c +++ b/src/lib/krb5/krb/tgtname.c @@ -32,7 +32,6 @@ static char rcsid_tgtname_c [] = #include #include -#include /* This is an internal-only function, used by krb5_get_cred_from_kdc() */ @@ -42,7 +41,7 @@ const krb5_data *client, *server; krb5_principal *tgtprinc; { return krb5_build_principal_ext(tgtprinc, server->length, server->data, - sizeof(TGTNAME) - 1, TGTNAME, + KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, client->length, client->data, 0); } diff --git a/src/tests/hammer/kdc5_hammer.c b/src/tests/hammer/kdc5_hammer.c index bb7f60047..9bb93479e 100644 --- a/src/tests/hammer/kdc5_hammer.c +++ b/src/tests/hammer/kdc5_hammer.c @@ -35,7 +35,6 @@ static char rcsid_hammer_c [] = #include #include #include -#include /* for TGTNAME */ #include #include @@ -61,8 +60,8 @@ krb5_parse_lifetime (time, len) } krb5_data tgtname = { - sizeof(TGTNAME)-1, - TGTNAME + KRB5_TGS_NAME_SIZE, + KRB5_TGS_NAME }; int verify_cs_pair PROTOTYPE((char *, -- 2.26.2