From: Sam Hartman Date: Wed, 23 Dec 2009 21:10:44 +0000 (+0000) Subject: Use global constant for string components of anonymous and wellknown X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaa5dd17ce0b4de5a9ea0f54831a44f268a22e45;p=thirdparty%2Fkrb5.git Use global constant for string components of anonymous and wellknown names. git-svn-id: svn://anonsvn.mit.edu/krb5/branches/anonymous@23508 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index b6f83420af..1ecf6d4aa6 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -470,7 +470,9 @@ k5_begin(opts, k5) if (opts->anonymous) { code = krb5_build_principal_ext(k5->ctx, &k5->me, strlen(opts->principal_name), opts->principal_name, - 9, "WELLKNOWN", 9, "ANONYMOUS", 0); + strlen(KRB5_WELLKNOWN_NAMESTR), KRB5_WELLKNOWN_NAMESTR, + strlen(KRB5_ANONYMOUS_PRINCSTR), + KRB5_ANONYMOUS_PRINCSTR, 0); if (code) { com_err(progname, code, "while setting up anonymous principal"); return 0; diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index 8e97fee294..ac89a3c729 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -262,6 +262,7 @@ typedef krb5_principal_data * krb5_principal; /* Windows 2000 UPN */ #define KRB5_NT_ENTERPRISE_PRINCIPAL 10 #define KRB5_NT_WELLKNOWN 11 +#define KRB5_WELLKNOWN_NAMESTR "WELLKNOWN" /*first component of NT_WELLKNOWN principals*/ /* Windows 2000 UPN and SID */ #define KRB5_NT_MS_PRINCIPAL -128 /* NT 4 style name */ @@ -300,7 +301,8 @@ const krb5_data *KRB5_CALLCONV krb5_anonymous_realm(void); krb5_const_principal KRB5_CALLCONV krb5_anonymous_principal(void); - +#define KRB5_ANONYMOUS_REALMSTR "WELLKNOWN:ANONYMOUS" +#define KRB5_ANONYMOUS_PRINCSTR "ANONYMOUS" /*wellknown name type*/ /* * end "base-defs.h" */ diff --git a/src/lib/krb5/krb/bld_princ.c b/src/lib/krb5/krb/bld_princ.c index e4532ef6ef..8378599d3b 100644 --- a/src/lib/krb5/krb/bld_princ.c +++ b/src/lib/krb5/krb/bld_princ.c @@ -190,12 +190,12 @@ krb5_build_principal(krb5_context context, /*Anonymous and well known principals*/ static const char anon_realm_str[] -= "WELLKNOWN:ANONYMOUS"; += KRB5_ANONYMOUS_REALMSTR; static const krb5_data anon_realm_data = { KV5M_DATA, sizeof(anon_realm_str)-1, (char *) anon_realm_str}; -static const char wellknown_str[] = "WELLKNOWN"; -static const char anon_str[] = "ANONYMOUS"; +static const char wellknown_str[] = KRB5_WELLKNOWN_NAMESTR; +static const char anon_str[] = KRB5_ANONYMOUS_PRINCSTR; static const krb5_data anon_princ_data[] = { {KV5M_DATA, sizeof(wellknown_str)-1, (char *) wellknown_str}, {KV5M_DATA, sizeof(anon_str)-1, (char *)anon_str}