From: Erez Zadok Date: Wed, 26 Oct 2005 03:35:50 +0000 (+0000) Subject: * amq/pawd.c (transform_dir): resolve path repeatedly until X-Git-Tag: am-utils-6_2a2~31 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=0b7ccc3c5cf627a9873c71799c1046f05014df9e;p=am-utils-6.0.git * amq/pawd.c (transform_dir): resolve path repeatedly until finished. Bug fix from Jonathan Chen . Added safety check to prevent infinite loops. --- diff --git a/AUTHORS b/AUTHORS index c282521..37c1bee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -397,6 +397,7 @@ October 22, 2004: patch/fix to move mlock/mlockall/plock code after the fork(). June 29, 2005: core dump going off end of exported_ap[] array. September 29, 2005: patch/fix for pawd not to go into an infinite loop. +October 25, 2005: patch/fix for pawd to repeatedly resolve path. * David Rage January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors diff --git a/ChangeLog b/ChangeLog index 3c8772b..d9f1fc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-25 Erez Zadok + + * amq/pawd.c (transform_dir): resolve path repeatedly until + finished. Bug fix from Jonathan Chen . + Added safety check to prevent infinite loops. + 2005-10-19 Erez Zadok * doc/am-utils.texi (opts Option): document new pcfs options diff --git a/NEWS b/NEWS index 5780146..8479d42 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ shortname, user=N, group=N, mask=N, and dirmask=N. - Bugs fixed: * correctly print nfs_args->addr info (sin_family/port/addr) + * pawd should resolve path repeatedly until no more to do *** Notes specific to am-utils version 6.2a1 diff --git a/amq/pawd.c b/amq/pawd.c index 39b1764..a7d77f6 100644 --- a/amq/pawd.c +++ b/amq/pawd.c @@ -57,6 +57,9 @@ #include #include +/* maximum number of transformations for each path */ +#define MAX_LOOP 10 + /* statics */ static char *localhost = "localhost"; static char transform[MAXPATHLEN]; @@ -182,6 +185,7 @@ transform_dir(char *dir) struct timeval tmo = {10, 0}; char *dummystr; amq_string *spp; + int again = 1, maxloop = MAX_LOOP; #ifdef DISK_HOME_HACK if (ch = hack_name(dir)) @@ -208,11 +212,21 @@ transform_dir(char *dir) return dir; xstrlcpy(transform, dir, sizeof(transform)); - dummystr = transform; - spp = amqproc_pawd_1((amq_string *) &dummystr, clnt); - if (spp && *spp && **spp) { - xstrlcpy(transform, *spp, sizeof(transform)); - XFREE(*spp); + while (again) { + if (--maxloop <= 0) { + fprintf(stderr, "pawd: exceeded maximum no. of transformations (%d)\n", + MAX_LOOP); + break; + } + again = 0; + dummystr = transform; + spp = amqproc_pawd_1((amq_string *) &dummystr, clnt); + if (spp && *spp && **spp) { + if (STREQ(transform, *spp)) + again++; + xstrlcpy(transform, *spp, sizeof(transform)); + XFREE(*spp); + } } clnt_destroy(clnt); return transform;