From 7dc0e19ed202f7fc58c85e6f65a15cc8db379396 Mon Sep 17 00:00:00 2001 From: "fredrik@DOLDA2000.COM" Date: Sat, 5 Mar 2005 00:50:12 +0000 Subject: [PATCH] Allow postfixes for the renew option. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@180 959494ce-11ee-0310-bf91-de5d638817bd --- pam_krb5auto.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pam_krb5auto.c b/pam_krb5auto.c index 20b600b..9b1a9ce 100644 --- a/pam_krb5auto.c +++ b/pam_krb5auto.c @@ -68,6 +68,8 @@ static struct options *parseopts(int argc, const char **argv) { int i; struct options *opts; + const char *p; + int unit; opts = malloc(sizeof(*opts)); memset(opts, 0, sizeof(*opts)); @@ -78,8 +80,21 @@ static struct options *parseopts(int argc, const char **argv) opts->instance = strdup(argv[i] + 9); if(!strncmp(argv[i], "keytab=", 7)) opts->keytab = strdup(argv[i] + 7); - if(!strncmp(argv[i], "renew=", 6)) - opts->renewable = atoi(argv[i] + 6); + if(!strncmp(argv[i], "renew=", 6)) { + p = argv[i] + strlen(argv[i]) - 1; + unit = 1; + if((*p >= 'a') && (*p <= 'z')) { + if(*p == 'm') + unit = 60; + else if(*p == 'h') + unit = 3600; + else if(*p == 'd') + unit = 86400; + else + unit = 1; + } + opts->renewable = atoi(argv[i] + 6) * unit; + } if(!strcmp(argv[i], "forwardable")) opts->forwardable = 1; if(!strcmp(argv[i], "debug")) -- 2.11.0