mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-22 18:24:23 +03:00
* 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.
This commit is contained in:
parent
8c0051403a
commit
8e1af10110
@ -1,5 +1,13 @@
|
||||
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
|
||||
has readonly attribute. Add execute permissions for directory.
|
||||
Reformat whole function.
|
||||
|
@ -416,9 +416,10 @@ 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, 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,
|
||||
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,
|
||||
char *user,
|
||||
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 *w_time, SMB_INO_T *ino);
|
||||
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,
|
||||
const char *old_password);
|
||||
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
|
||||
****************************************************************************/
|
||||
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 *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 comment_offset = IVAL(p,16) & 0xFFFF;
|
||||
char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
|
||||
fn(sname, type, cmnt);
|
||||
fn(sname, type, cmnt, state);
|
||||
}
|
||||
} else {
|
||||
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.
|
||||
****************************************************************************/
|
||||
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 *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;
|
||||
|
||||
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
|
||||
****************************************************************************/
|
||||
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;
|
||||
/* 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++) {
|
||||
p += interpret_long_filename(info_level,p,&finfo);
|
||||
fn(&finfo, Mask);
|
||||
fn(&finfo, Mask, state);
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
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 = "";
|
||||
|
||||
@ -452,7 +452,7 @@ browsing_helper (const char *name, uint32 type, const char *comment)
|
||||
}
|
||||
|
||||
static void
|
||||
loaddir_helper (file_info * finfo, const char *mask)
|
||||
loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
||||
{
|
||||
dir_entry *new_entry;
|
||||
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
|
||||
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);
|
||||
|
||||
@ -675,14 +675,14 @@ smbfs_loaddir (opendir_info *smbfs_info)
|
||||
DEBUG(6, ("smbfs_loaddir: browsing %s\n", IPC));
|
||||
/* browse for servers */
|
||||
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;
|
||||
else
|
||||
current_server_info = smbfs_info;
|
||||
smbfs_info->server_list = TRUE;
|
||||
} else {
|
||||
/* 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;
|
||||
else
|
||||
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));
|
||||
/* do file listing: cli_list returns number of files */
|
||||
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 */
|
||||
my_errno = cli_error(smbfs_info->conn->cli, NULL, &err, NULL);
|
||||
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 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 */
|
||||
|
||||
@ -1316,7 +1316,7 @@ get_remote_stat(smbfs_connection *sc, char *path, struct stat *buf)
|
||||
|
||||
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;
|
||||
g_free (mypath);
|
||||
return -1; /* cli_list returns number of files */
|
||||
|
Loading…
x
Reference in New Issue
Block a user