関数 | |
static BOOL | read_target_host (const char *mapfile, pstring targethost) |
static BOOL | expand_msdfs_target (connection_struct *conn, pstring target) |
static int | expand_msdfs_readlink (struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) |
NTSTATUS | vfs_expand_msdfs_init (void) |
変数 | |
userdom_struct | current_user_info |
static vfs_op_tuple | expand_msdfs_ops [] |
vfs_expand_msdfs.c の 41 行で定義されています。
参照先 buf・client_addr()・errno・space・strchr_m()・strerror()・x_fclose()・x_fgets()・x_fopen().
00042 { 00043 XFILE *f; 00044 pstring buf; 00045 char *space = buf; 00046 BOOL found = False; 00047 00048 f = x_fopen(mapfile, O_RDONLY, 0); 00049 00050 if (f == NULL) { 00051 DEBUG(0,("can't open IP map %s. Error %s\n", 00052 mapfile, strerror(errno) )); 00053 return False; 00054 } 00055 00056 DEBUG(10, ("Scanning mapfile [%s]\n", mapfile)); 00057 00058 while (x_fgets(buf, sizeof(buf), f) != NULL) { 00059 00060 if ((strlen(buf) > 0) && (buf[strlen(buf)-1] == '\n')) 00061 buf[strlen(buf)-1] = '\0'; 00062 00063 DEBUG(10, ("Scanning line [%s]\n", buf)); 00064 00065 space = strchr_m(buf, ' '); 00066 00067 if (space == NULL) { 00068 DEBUG(0, ("Ignoring invalid line %s\n", buf)); 00069 continue; 00070 } 00071 00072 *space = '\0'; 00073 00074 if (strncmp(client_addr(), buf, strlen(buf)) == 0) { 00075 found = True; 00076 break; 00077 } 00078 } 00079 00080 x_fclose(f); 00081 00082 if (!found) 00083 return False; 00084 00085 space += 1; 00086 00087 while (isspace(*space)) 00088 space += 1; 00089 00090 pstrcpy(targethost, space); 00091 return True; 00092 }
static BOOL expand_msdfs_target | ( | connection_struct * | conn, | |
pstring | target | |||
) | [static] |
vfs_expand_msdfs.c の 107 行で定義されています。
参照先 connection_struct::connectpath・current_user_info・userdom_struct::domain・get_current_username()・connection_struct::gid・read_target_host()・standard_sub_advanced()・strchr_m()・connection_struct::user.
00108 { 00109 pstring mapfilename; 00110 char *filename_start = strchr_m(target, '@'); 00111 char *filename_end; 00112 int filename_len; 00113 pstring targethost; 00114 pstring new_target; 00115 00116 if (filename_start == NULL) { 00117 DEBUG(10, ("No filename start in %s\n", target)); 00118 return False; 00119 } 00120 00121 filename_end = strchr_m(filename_start+1, '@'); 00122 00123 if (filename_end == NULL) { 00124 DEBUG(10, ("No filename end in %s\n", target)); 00125 return False; 00126 } 00127 00128 filename_len = PTR_DIFF(filename_end, filename_start+1); 00129 pstrcpy(mapfilename, filename_start+1); 00130 mapfilename[filename_len] = '\0'; 00131 00132 DEBUG(10, ("Expanding from table [%s]\n", mapfilename)); 00133 00134 if (!read_target_host(mapfilename, targethost)) { 00135 DEBUG(1, ("Could not expand target host from file %s\n", 00136 mapfilename)); 00137 return False; 00138 } 00139 00140 standard_sub_advanced(lp_servicename(SNUM(conn)), conn->user, 00141 conn->connectpath, conn->gid, 00142 get_current_username(), 00143 current_user_info.domain, 00144 mapfilename, sizeof(mapfilename)); 00145 00146 DEBUG(10, ("Expanded targethost to %s\n", targethost)); 00147 00148 *filename_start = '\0'; 00149 pstrcpy(new_target, target); 00150 pstrcat(new_target, targethost); 00151 pstrcat(new_target, filename_end+1); 00152 00153 DEBUG(10, ("New DFS target: %s\n", new_target)); 00154 pstrcpy(target, new_target); 00155 return True; 00156 }
static int expand_msdfs_readlink | ( | struct vfs_handle_struct * | handle, | |
const char * | path, | |||
char * | buf, | |||
size_t | bufsiz | |||
) | [static] |
vfs_expand_msdfs.c の 158 行で定義されています。
参照先 errno・expand_msdfs_target()・handle・result・strchr_m().
00160 { 00161 pstring target; 00162 int result; 00163 00164 result = SMB_VFS_NEXT_READLINK(handle, path, target, 00165 sizeof(target)); 00166 00167 if (result < 0) 00168 return result; 00169 00170 target[result] = '\0'; 00171 00172 if ((strncmp(target, "msdfs:", strlen("msdfs:")) == 0) && 00173 (strchr_m(target, '@') != NULL)) { 00174 if (!expand_msdfs_target(handle->conn, target)) { 00175 errno = ENOENT; 00176 return -1; 00177 } 00178 } 00179 00180 safe_strcpy(buf, target, bufsiz-1); 00181 return strlen(buf); 00182 }
NTSTATUS vfs_expand_msdfs_init | ( | void | ) |
vfs_expand_msdfs.c の 193 行で定義されています。
参照先 expand_msdfs_ops・smb_register_vfs().
00194 { 00195 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "expand_msdfs", 00196 expand_msdfs_ops); 00197 }
substitute.c の 29 行で定義されています。
vfs_op_tuple expand_msdfs_ops[] [static] |
初期値:
{ {SMB_VFS_OP(expand_msdfs_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }
vfs_expand_msdfs.c の 186 行で定義されています。