X-Git-Url: http://dolda2000.com/gitweb/?p=utils.git;a=blobdiff_plain;f=pam_krb5auto.c;h=3ca6bf447b0b55b73f2850c2337467801617b0a0;hp=eb990d263f99b353b58f5ea3251d2fb1792b2639;hb=f7bd9b51138dbccb7cc2fd27f07ef66d5d2d79cf;hpb=e1427cb71004d1aebdceb48b615f2f407f450dd0 diff --git a/pam_krb5auto.c b/pam_krb5auto.c index eb990d2..3ca6bf4 100644 --- a/pam_krb5auto.c +++ b/pam_krb5auto.c @@ -1,9 +1,28 @@ +/* + * pam_krb5auto - Gets initial credentials non-interactively + * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ #include #include #include #include #include #include +#include #include #include #include @@ -50,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)); @@ -60,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"))