From f62acdf3691b2774fd77c98129aaeb4504892fdf Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Tue, 14 Oct 1997 22:37:30 +0000 Subject: [PATCH] update from krb4 git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3612 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/xnlock/xnlock.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/appl/xnlock/xnlock.c b/appl/xnlock/xnlock.c index 3d2abbc9f..d4839831b 100644 --- a/appl/xnlock/xnlock.c +++ b/appl/xnlock/xnlock.c @@ -229,18 +229,17 @@ init_words (int argc, char **argv) errx (1, "cannot allocate memory for message"); } } else { - appres.text = strdup(""); + int j; + int len = 1; + for(j = i; argv[j]; j++) + len += strlen(argv[j]) + 1; + appres.text = malloc(len); if (appres.text == NULL) errx (1, "cannot allocate memory for message"); - while (argv[i]) { - int n = strlen (argv[i]); - char *tmp = realloc(appres.text, - strlen(appres.text) + n + 2); - if (tmp == NULL) - errx (1, "cannot allocate memory for message"); - strcat (appres.text, argv[i]); - strcat (appres.text, " "); - ++i; + appres.text[0] = 0; + for(; i < j; i++){ + strcat(appres.text, argv[i]); + strcat(appres.text, " "); } } } @@ -545,6 +544,7 @@ countdown(XtPointer _t, XtIntervalId *_d) return; } +#ifdef KRB5 static int verify_krb5(const char *name, const char *inst, const char *realm, const char *password) @@ -578,7 +578,7 @@ verify_krb5(const char *name, const char *inst, const char *realm, krb5_free_context(context); return -1; } - +#endif static int verify(char *password) @@ -620,11 +620,13 @@ verify(char *password) if (unix_verify_user(name, password) == 0) return 0; +#ifdef KRB5 /* * Try to verify as user with kerberos 5. */ if(verify_krb5(name, inst, realm, password) == 0) return 0; +#endif /* * Try to verify as user with kerberos 4.