From e435e248f44c46866cb73db185b9548c0bd148b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 24 Jul 2009 12:58:26 -0400 Subject: [PATCH] Running bos -noauth should not require client CellServDB configuration When setting up a new cell, the admin is instructed to use "bos -noauth" to configure the servers and only afterwards create the client configuration. This leads to a catch-22 since currently bos -noauth fails if there is no client configuration even though it is not required. This change avoids the call to afsconf_Open() which is only required if tokens are being acquired. FIXES 125156 Reviewed-on: http://gerrit.openafs.org/209 Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/bozo/bos.c | 58 ++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/bozo/bos.c b/src/bozo/bos.c index fc4bceba6..e7e7f3397 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -189,40 +189,42 @@ GetConn(struct cmd_syndesc *as, int aencrypt) } memcpy(&addr, th->h_addr, sizeof(afs_int32)); - /* get tokens for making authenticated connections */ - localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); - confdir = - (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); - tdir = afsconf_Open(confdir); - if (tdir) { - struct afsconf_cell info; - char *tname; - - if (as->parms[ADDPARMOFFSET].items) - tname = as->parms[ADDPARMOFFSET].items->data; - else - tname = NULL; - /* next call expands cell name abbrevs for us and handles looking up - * local cell */ - code = afsconf_GetCellInfo(tdir, tname, NULL, &info); - if (code) { - afs_com_err("bos", code, "(can't find cell '%s' in cell database)", - (tname ? tname : "")); - exit(1); - } else - strcpy(sname.cell, info.name); - } else { - printf("bos: can't open cell database (%s)\n", confdir); - exit(1); - } - sname.instance[0] = 0; - strcpy(sname.name, "afs"); + /* Start with no authentication */ sc[0] = rxnull_NewClientSecurityObject(); sc[1] = 0; sc[2] = 0; scIndex = 0; if (!as->parms[ADDPARMOFFSET + 1].items) { /* not -noauth */ + /* get tokens for making authenticated connections */ + localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); + confdir = + (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); + tdir = afsconf_Open(confdir); + if (tdir) { + struct afsconf_cell info; + char *tname; + + if (as->parms[ADDPARMOFFSET].items) + tname = as->parms[ADDPARMOFFSET].items->data; + else + tname = NULL; + /* next call expands cell name abbrevs for us and handles looking up + * local cell */ + code = afsconf_GetCellInfo(tdir, tname, NULL, &info); + if (code) { + afs_com_err("bos", code, "(can't find cell '%s' in cell database)", + (tname ? tname : "")); + exit(1); + } else + strcpy(sname.cell, info.name); + } else { + printf("bos: can't open cell database (%s)\n", confdir); + exit(1); + } + sname.instance[0] = 0; + strcpy(sname.name, "afs"); + if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */ code = afsconf_GetLatestKey(tdir, 0, 0); if (code) -- 2.39.5