From: Jeffrey Altman Date: Fri, 14 Jun 2013 02:29:39 +0000 (-0400) Subject: Windows: fixup cellular make mount X-Git-Tag: upstream/1.8.0_pre1^2~1122 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5cd6407c936f8c069336faf94a12b4a475aac0db;p=packages%2Fo%2Fopenafs.git Windows: fixup cellular make mount Ensure that all input strings contain a trailing dot. 'fsvolume' contains the trailing dot so do not add an extra one. Change-Id: I183581d3b06a586da872edc4af54c5e34798cdf4 Reviewed-on: http://gerrit.openafs.org/9974 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 5aa05ed97..498f5e8ce 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -2063,6 +2063,13 @@ cm_IoctlCreateMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scac /* Extract the possibly partial cell name */ mpp = cm_ParseIoctlStringAlloc(ioctlp, NULL); + + len = cm_ClientStrLen(mpp); + if (len <= 1 || mpp[len-1] != L'.') { + code = CM_ERROR_INVAL; + goto done; + } + cell = cm_ClientCharNext(mpp); if (cp = cm_ClientStrChr(cell, ':')) { @@ -2080,7 +2087,8 @@ cm_IoctlCreateMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scac goto done; } - StringCbPrintfA(mpInfo, sizeof(mpInfo), "%c%s:%s.", (char) *mpp, + /* fsvolume includes the trailing dot */ + StringCbPrintfA(mpInfo, sizeof(mpInfo), "%c%s:%s", (char) *mpp, fullCell, fsvolume); } else { @@ -2090,10 +2098,9 @@ cm_IoctlCreateMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scac cellp = cm_FindCellByID(dscp->fid.cell, CM_FLAG_NOPROBE); } - /* remove the trailing dot if it is present */ + /* remove the trailing dot */ len = strlen(fsvolume); - if (len > 1 && fsvolume[len-1] == '.') - fsvolume[len-1] = '\0'; + fsvolume[len-1] = '\0'; /* validate the target info */ if (cm_VolNameIsID(fsvolume)) {