*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
+extern userdom_struct current_user_info;
+
/**********************************************************
Under mapfile we expect a table of the following format:
{
XFILE *f;
pstring buf;
- char *s, *space = buf;
+ char *space = buf;
BOOL found = False;
f = x_fopen(mapfile, O_RDONLY, 0);
DEBUG(10, ("Scanning mapfile [%s]\n", mapfile));
- while ((s=fgets_slash(buf, sizeof(buf), f)) != NULL) {
+ while (x_fgets(buf, sizeof(buf), f) != NULL) {
+
+ if ((strlen(buf) > 0) && (buf[strlen(buf)-1] == '\n'))
+ buf[strlen(buf)-1] = '\0';
+
+ DEBUG(10, ("Scanning line [%s]\n", buf));
+
space = strchr_m(buf, ' ');
if (space == NULL) {
return False;
}
- standard_sub_conn(conn, mapfilename, sizeof(mapfilename));
+ standard_sub_advanced(lp_servicename(SNUM(conn)), conn->user,
+ conn->connectpath, conn->gid,
+ get_current_username(),
+ current_user_info.domain,
+ mapfilename, sizeof(mapfilename));
DEBUG(10, ("Expanded targethost to %s\n", targethost));
}
static int expand_msdfs_readlink(struct vfs_handle_struct *handle,
- struct connection_struct *conn,
const char *path, char *buf, size_t bufsiz)
{
pstring target;
int result;
- result = SMB_VFS_NEXT_READLINK(handle, conn, path, target,
+ result = SMB_VFS_NEXT_READLINK(handle, path, target,
sizeof(target));
if (result < 0)
target[result] = '\0';
- if (strchr_m(target, '@') != NULL) {
- if (!expand_msdfs_target(conn, target)) {
+ if ((strncmp(target, "msdfs:", strlen("msdfs:")) == 0) &&
+ (strchr_m(target, '@') != NULL)) {
+ if (!expand_msdfs_target(handle->conn, target)) {
errno = ENOENT;
return -1;
}
{SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
};
+NTSTATUS vfs_expand_msdfs_init(void);
NTSTATUS vfs_expand_msdfs_init(void)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "expand_msdfs",