X-Git-Url: http://dolda2000.com/gitweb/?p=utils.git;a=blobdiff_plain;f=pam_krb5auto.c;h=3ca6bf447b0b55b73f2850c2337467801617b0a0;hp=20b600ba598a147b9039fa97669a325c7b88a711;hb=refs%2Fheads%2Fmaster;hpb=7ccba69563f89475dc8047743b1a72e82ccb6e08 diff --git a/pam_krb5auto.c b/pam_krb5auto.c index 20b600b..3ca6bf4 100644 --- a/pam_krb5auto.c +++ b/pam_krb5auto.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,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 +81,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"))