[OpenAFS-devel] supporting non /afs root in windows client
Andrei Keis
Andrei.Keis@morganstanley.com
Mon, 04 Nov 2002 09:44:55 -0500
This is a multi-part message in MIME format.
--------------C4D356D6BFB02D013195DC06
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
there is a bug in windows client when reading Mountroot parameter. This
parameter is used to determine if a symlink lives in afs namespace or not. By
default (if the paramter is not specified) it is set to afs.
The bug is that
code = RegQueryValueEx(parmKey, "Mountroot", NULL, NULL,
cm_mountRoot, &cm_mountRootLen);
will set cm_mountRootLen to be the length of the parameter including null in the
end of the string (this is how regquery works). Since this value is used in
strncmp
cm_vnodeops.c : 1203
if (strncmp(linkp, cm_mountRoot, cm_mountRootLen) == 0) {
it will never succeed. The effect is that absolute symlinks will not work if afs
mount point is different from /afs
The fix is to set the length using strlen after the parameter is obtained from
registry:
afsd_init.c : 329
if (code == ERROR_SUCCESS)
{
afsi_log("Mount root %s", cm_mountRoot);
cm_mountRootLen = strlen(cm_mountRoot);
}
else {
strcpy(cm_mountRoot, "/afs");
cm_mountRootLen = 4;
/* Don't log */
}
Diff attached.
Thanks,
Andrei.
--------------C4D356D6BFB02D013195DC06
Content-Type: text/plain; charset=us-ascii;
name="afsd_init.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="afsd_init.diff"
--- afsd_init.c Thu Oct 31 14:13:07 2002
+++ e:\openafs\1.2.6_original\openafs-1.2.6\src\WINNT\afsd\afsd_init.c Sat Oct 13 00:19:06 2001
@@ -324,10 +324,7 @@
code = RegQueryValueEx(parmKey, "Mountroot", NULL, NULL,
cm_mountRoot, &cm_mountRootLen);
if (code == ERROR_SUCCESS)
- {
afsi_log("Mount root %s", cm_mountRoot);
- cm_mountRootLen = strlen(cm_mountRoot);
- }
else {
strcpy(cm_mountRoot, "/afs");
cm_mountRootLen = 4;
--------------C4D356D6BFB02D013195DC06--