diff options
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/libsmb/clientgen.c | 2 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.c | 18 |
4 files changed, 21 insertions, 5 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 7eb3e1abc2..08d4476da9 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -343,7 +343,7 @@ void dump_data(int level,char *buf1,int len); char *tab_depth(int depth); char *sid_to_string(pstring sidstr_out, DOM_SID *sid); BOOL string_to_sid(DOM_SID *sidout, char *sidstr); -int str_checksum(char *s); +int str_checksum(const char *s); void zero_free(void *p, size_t size); /*The following definitions come from libsmb/clientgen.c */ @@ -361,7 +361,7 @@ BOOL cli_api(struct cli_state *cli, char **rparam, int *rprcnt, char **rdata, int *rdrcnt); BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation); -BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, char *)); +BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *)); BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, void (*fn)(char *, uint32, char *)); BOOL cli_session_setup(struct cli_state *cli, diff --git a/source3/lib/util.c b/source3/lib/util.c index c6073cf9d6..313021abb8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -4809,7 +4809,7 @@ BOOL string_to_sid(DOM_SID *sidout, char *sidstr) * * **************************************************************************** */ -int str_checksum(char *s) +int str_checksum(const char *s) { int res = 0; int c; diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 0a61a74cce..bd044f4e26 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -448,7 +448,7 @@ BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation) /**************************************************************************** call a NetShareEnum - try and browse available connections on a host ****************************************************************************/ -BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, char *)) +BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *)) { char *rparam = NULL; char *rdata = NULL; diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index d77f33c97e..3a98143260 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -30,6 +30,7 @@ struct smbw_server { struct cli_state cli; char *server_name; char *share_name; + dev_t dev; }; struct smbw_file { @@ -121,6 +122,13 @@ BOOL smbw_fd(int fd) return (fd >= SMBW_FD_OFFSET); } +/***************************************************** +a crude inode number generator +*******************************************************/ +ino_t smbw_inode(const char *name) +{ + return (ino_t)str_checksum(name); +} /***************************************************** remove redundent stuff from a filename @@ -422,6 +430,8 @@ struct smbw_server *smbw_server(char *server, char *share) srv->cli = c; + srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share)); + srv->server_name = strdup(server); if (!srv->server_name) { errno = ENOMEM; @@ -503,6 +513,7 @@ void smbw_setup_stat(struct stat *st, char *fname, size_t size, int mode) st->st_blocks = (size+511)/512; st->st_uid = getuid(); st->st_gid = getgid(); + st->st_ino = smbw_inode(fname); } @@ -653,6 +664,7 @@ int smbw_dir_open(const char *fname, int flags) bitmap_set(file_bmap, fd); dir->fd = fd + SMBW_FD_OFFSET; + dir->srv = srv; DEBUG(4,(" -> %d\n", dir->count)); @@ -782,6 +794,8 @@ int smbw_dir_fstat(int fd, struct stat *st) smbw_setup_stat(st, "", dir->count*sizeof(struct dirent), aDIR); + st->st_dev = dir->srv->dev; + return 0; } @@ -820,6 +834,7 @@ int smbw_fstat(int fd, struct stat *st) st->st_atime = a_time; st->st_ctime = c_time; st->st_mtime = m_time; + st->st_dev = file->srv->dev; DEBUG(4,("%s - OK\n", __FUNCTION__)); @@ -876,6 +891,7 @@ int smbw_stat(const char *fname, struct stat *st) st->st_atime = time(NULL); st->st_ctime = m_time; st->st_mtime = m_time; + st->st_dev = srv->dev; smbw_busy--; return 0; @@ -1046,13 +1062,13 @@ int smbw_getdents(unsigned int fd, struct dirent *dirp, int count) } while (count>=sizeof(*dirp) && (dir->offset < dir->count)) { - dirp->d_ino = dir->offset + 0x10000; dirp->d_off = (dir->offset+1)*sizeof(*dirp); dirp->d_reclen = sizeof(*dirp); /* what's going on with the -1 here? maybe d_type isn't really there? */ safe_strcpy(&dirp->d_name[-1], dir->list[dir->offset].name, sizeof(dirp->d_name)-1); + dirp->d_ino = smbw_inode(dir->list[dir->offset].name); dir->offset++; count -= dirp->d_reclen; if (dir->offset == dir->count) { |