From 5cd6407c936f8c069336faf94a12b4a475aac0db Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 13 Jun 2013 22:29:39 -0400 Subject: [PATCH] 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 --- src/WINNT/afsd/cm_ioctl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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)) { -- 2.39.5