diff options
author | Ken Raeburn <raeburn@mit.edu> | 2010-10-23 22:25:51 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2010-10-23 22:25:51 +0000 |
commit | 5c3e187913cc3a8a3bc7ac37e49b43f9eb5996be (patch) | |
tree | f503aa126943148b307a71e459b176514394f530 | |
parent | 03a197a41f4f8d2cd2ec5da3892a006bd1b0d265 (diff) | |
download | krb5-5c3e187913cc3a8a3bc7ac37e49b43f9eb5996be.zip krb5-5c3e187913cc3a8a3bc7ac37e49b43f9eb5996be.tar.gz krb5-5c3e187913cc3a8a3bc7ac37e49b43f9eb5996be.tar.bz2 |
Try harder to retain the "brand" string in the shared library
Make the brand array non-static, and actually use the value in (the
infrequently-called) krb5_init_secure_context.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24471 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/krb5/krb/brand.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/krb/init_ctx.c | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/krb5/krb/brand.c b/src/lib/krb5/krb/brand.c index fc098dd..c7b8a61 100644 --- a/src/lib/krb5/krb/brand.c +++ b/src/lib/krb5/krb/brand.c @@ -70,4 +70,4 @@ #define BRANDSTR RELTAG " " RELNAME " " RELDATE -static char krb5_brand[] = "KRB5_BRAND: " BRANDSTR; +char krb5_brand[] = "KRB5_BRAND: " BRANDSTR; diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index 30ae2ef..91ed6e1 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -91,10 +91,19 @@ krb5_init_context(krb5_context *context) krb5_error_code KRB5_CALLCONV krb5_init_secure_context(krb5_context *context) { - - /* This is to make gcc -Wall happy */ - if(0) krb5_brand[0] = krb5_brand[0]; - return init_common (context, TRUE, FALSE); + /* + * This is rather silly, but should improve our chances of + * retaining the krb5_brand array in the final linked library, + * better than a static variable that's unreferenced after + * optimization, or even a non-static symbol that's not exported + * from the library nor referenced from anywhere else in the + * library. + * + * If someday we grow an API to actually return the string, we can + * get rid of this silliness. + */ + int my_false = (krb5_brand[0] == 0); + return init_common (context, TRUE, my_false); } krb5_error_code |