* samba/libsmb/clientgen.c (cli_NetServerEnum): Add void*
parameter to (*fn)() and void *state parameter. (cli_list): Likewise. (cli_RNetShareEnum): Likewise. Return int. * samba/include/proto.h: Adjust declarations. * smbfs.c: Adjust all helpers and dependencies. From Samba patchsets.
Этот коммит содержится в:
родитель
8c0051403a
Коммит
8e1af10110
@ -1,5 +1,13 @@
|
|||||||
2002-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
2002-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* samba/libsmb/clientgen.c (cli_NetServerEnum): Add void*
|
||||||
|
parameter to (*fn)() and void *state parameter.
|
||||||
|
(cli_list): Likewise.
|
||||||
|
(cli_RNetShareEnum): Likewise. Return int.
|
||||||
|
* samba/include/proto.h: Adjust declarations.
|
||||||
|
* smbfs.c: Adjust all helpers and dependencies.
|
||||||
|
From Samba patchsets.
|
||||||
|
|
||||||
* smbfs.c (loaddir_helper): Remove write permissions if file
|
* smbfs.c (loaddir_helper): Remove write permissions if file
|
||||||
has readonly attribute. Add execute permissions for directory.
|
has readonly attribute. Add execute permissions for directory.
|
||||||
Reformat whole function.
|
Reformat whole function.
|
||||||
|
@ -416,9 +416,10 @@ BOOL cli_api(struct cli_state *cli,
|
|||||||
char **rparam, int *rprcnt,
|
char **rparam, int *rprcnt,
|
||||||
char **rdata, int *rdrcnt);
|
char **rdata, int *rdrcnt);
|
||||||
BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
|
BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
|
||||||
BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
|
int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
|
||||||
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
||||||
void (*fn)(const char *, uint32, const char *));
|
void (*fn)(const char *, uint32, const char *, void *),
|
||||||
|
void *state);
|
||||||
BOOL cli_session_setup(struct cli_state *cli,
|
BOOL cli_session_setup(struct cli_state *cli,
|
||||||
char *user,
|
char *user,
|
||||||
char *pass, int passlen,
|
char *pass, int passlen,
|
||||||
@ -461,7 +462,7 @@ BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
|
|||||||
time_t *c_time, time_t *a_time, time_t *m_time,
|
time_t *c_time, time_t *a_time, time_t *m_time,
|
||||||
time_t *w_time, SMB_INO_T *ino);
|
time_t *w_time, SMB_INO_T *ino);
|
||||||
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
||||||
void (*fn)(file_info *, const char *));
|
void (*fn)(file_info *, const char *, void *), void *state);
|
||||||
BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
|
BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
|
||||||
const char *old_password);
|
const char *old_password);
|
||||||
BOOL cli_negprot(struct cli_state *cli);
|
BOOL cli_negprot(struct cli_state *cli);
|
||||||
|
@ -535,7 +535,7 @@ BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
call a NetShareEnum - try and browse available connections on a host
|
call a NetShareEnum - try and browse available connections on a host
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *))
|
int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void * state)
|
||||||
{
|
{
|
||||||
char *rparam = NULL;
|
char *rparam = NULL;
|
||||||
char *rdata = NULL;
|
char *rdata = NULL;
|
||||||
@ -579,7 +579,7 @@ BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, c
|
|||||||
int type = SVAL(p,14);
|
int type = SVAL(p,14);
|
||||||
int comment_offset = IVAL(p,16) & 0xFFFF;
|
int comment_offset = IVAL(p,16) & 0xFFFF;
|
||||||
char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
|
char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
|
||||||
fn(sname, type, cmnt);
|
fn(sname, type, cmnt, state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG(4,("NetShareEnum res=%d\n", res));
|
DEBUG(4,("NetShareEnum res=%d\n", res));
|
||||||
@ -605,7 +605,7 @@ The callback function takes 3 arguments: the machine name, the server type and
|
|||||||
the comment.
|
the comment.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
||||||
void (*fn)(const char *, uint32, const char *))
|
void (*fn)(const char *, uint32, const char *, void *), void *state)
|
||||||
{
|
{
|
||||||
char *rparam = NULL;
|
char *rparam = NULL;
|
||||||
char *rdata = NULL;
|
char *rdata = NULL;
|
||||||
@ -656,7 +656,7 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
|||||||
|
|
||||||
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
|
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
|
||||||
|
|
||||||
fn(sname, stype, cmnt);
|
fn(sname, stype, cmnt, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1994,7 +1994,7 @@ static int interpret_long_filename(int level,char *p,file_info *finfo)
|
|||||||
do a directory listing, calling fn on each file found
|
do a directory listing, calling fn on each file found
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
||||||
void (*fn)(file_info *, const char *))
|
void (*fn)(file_info *, const char *, void *), void *state)
|
||||||
{
|
{
|
||||||
int max_matches = 512;
|
int max_matches = 512;
|
||||||
/* NT uses 260, OS/2 uses 2. Both accept 1. */
|
/* NT uses 260, OS/2 uses 2. Both accept 1. */
|
||||||
@ -2145,7 +2145,7 @@ int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
|
|||||||
|
|
||||||
for (p=dirlist,i=0;i<total_received;i++) {
|
for (p=dirlist,i=0;i<total_received;i++) {
|
||||||
p += interpret_long_filename(info_level,p,&finfo);
|
p += interpret_long_filename(info_level,p,&finfo);
|
||||||
fn(&finfo, Mask);
|
fn(&finfo, Mask, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free up the dirlist buffer */
|
/* free up the dirlist buffer */
|
||||||
|
16
vfs/smbfs.c
16
vfs/smbfs.c
@ -424,7 +424,7 @@ new_dir_entry (const char * name)
|
|||||||
|
|
||||||
/* browse for shares on server */
|
/* browse for shares on server */
|
||||||
static void
|
static void
|
||||||
browsing_helper (const char *name, uint32 type, const char *comment)
|
browsing_helper (const char *name, uint32 type, const char *comment, void *state)
|
||||||
{
|
{
|
||||||
char *typestr = "";
|
char *typestr = "";
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ browsing_helper (const char *name, uint32 type, const char *comment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
loaddir_helper (file_info * finfo, const char *mask)
|
loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
||||||
{
|
{
|
||||||
dir_entry *new_entry;
|
dir_entry *new_entry;
|
||||||
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
||||||
@ -520,7 +520,7 @@ convert_path(char **remote_file, gboolean trailing_asterik)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
server_browsing_helper (const char *name, uint32 m, const char *comment)
|
server_browsing_helper (const char *name, uint32 m, const char *comment, void *state)
|
||||||
{
|
{
|
||||||
dir_entry *new_entry = new_dir_entry (name);
|
dir_entry *new_entry = new_dir_entry (name);
|
||||||
|
|
||||||
@ -675,14 +675,14 @@ smbfs_loaddir (opendir_info *smbfs_info)
|
|||||||
DEBUG(6, ("smbfs_loaddir: browsing %s\n", IPC));
|
DEBUG(6, ("smbfs_loaddir: browsing %s\n", IPC));
|
||||||
/* browse for servers */
|
/* browse for servers */
|
||||||
if (!cli_NetServerEnum(smbfs_info->conn->cli, smbfs_info->conn->domain,
|
if (!cli_NetServerEnum(smbfs_info->conn->cli, smbfs_info->conn->domain,
|
||||||
SV_TYPE_ALL, server_browsing_helper))
|
SV_TYPE_ALL, server_browsing_helper, NULL), NULL)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
current_server_info = smbfs_info;
|
current_server_info = smbfs_info;
|
||||||
smbfs_info->server_list = TRUE;
|
smbfs_info->server_list = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* browse for shares */
|
/* browse for shares */
|
||||||
if (cli_RNetShareEnum(smbfs_info->conn->cli, browsing_helper) < 1)
|
if (cli_RNetShareEnum(smbfs_info->conn->cli, browsing_helper, NULL) < 1)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
current_share_info = smbfs_info;
|
current_share_info = smbfs_info;
|
||||||
@ -705,7 +705,7 @@ smbfs_loaddir (opendir_info *smbfs_info)
|
|||||||
DEBUG(6, ("smbfs_loaddir: calling cli_list with mask %s\n", my_dirname));
|
DEBUG(6, ("smbfs_loaddir: calling cli_list with mask %s\n", my_dirname));
|
||||||
/* do file listing: cli_list returns number of files */
|
/* do file listing: cli_list returns number of files */
|
||||||
if (cli_list(
|
if (cli_list(
|
||||||
smbfs_info->conn->cli, my_dirname, attribute, loaddir_helper) < 0) {
|
smbfs_info->conn->cli, my_dirname, attribute, loaddir_helper, NULL) < 0) {
|
||||||
/* cli_list returns -1 if directory empty or cannot read socket */
|
/* cli_list returns -1 if directory empty or cannot read socket */
|
||||||
my_errno = cli_error(smbfs_info->conn->cli, NULL, &err, NULL);
|
my_errno = cli_error(smbfs_info->conn->cli, NULL, &err, NULL);
|
||||||
g_free (my_dirname);
|
g_free (my_dirname);
|
||||||
@ -1264,7 +1264,7 @@ fake_share_stat(const char *server_url, const char *path, struct stat *buf)
|
|||||||
static dir_entry *single_entry;
|
static dir_entry *single_entry;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
statfile_helper (file_info * finfo, const char *mask)
|
statfile_helper (file_info * finfo, const char *mask, void * entry)
|
||||||
{
|
{
|
||||||
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
||||||
|
|
||||||
@ -1316,7 +1316,7 @@ get_remote_stat(smbfs_connection *sc, char *path, struct stat *buf)
|
|||||||
|
|
||||||
convert_path(&mypath, FALSE);
|
convert_path(&mypath, FALSE);
|
||||||
|
|
||||||
if (cli_list(sc->cli, mypath, attribute, statfile_helper) < 1) {
|
if (cli_list(sc->cli, mypath, attribute, statfile_helper, &single_entry) < 1) {
|
||||||
my_errno = ENOENT;
|
my_errno = ENOENT;
|
||||||
g_free (mypath);
|
g_free (mypath);
|
||||||
return -1; /* cli_list returns number of files */
|
return -1; /* cli_list returns number of files */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user