summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2001-01-06 14:48:55 +0000
committerRichard Sharpe <sharpe@samba.org>2001-01-06 14:48:55 +0000
commit34fea75f35b61841886234e5f167ecf32d95c9c2 (patch)
tree77304e9e04ba89ba27b5d01a6d927cb7183f5e4a /source3/libsmb
parenta0feaf62b7a25f05978b90f3b11b7e7f882e07dd (diff)
downloadsamba-34fea75f35b61841886234e5f167ecf32d95c9c2.tar.gz
samba-34fea75f35b61841886234e5f167ecf32d95c9c2.tar.bz2
samba-34fea75f35b61841886234e5f167ecf32d95c9c2.zip
Fix some more bugs in libsmbclient.c and add functionality to tree.c
(This used to be commit d6cef8877a7ed80329b3ba67231a94601fcfd060)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/libsmbclient.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 50d330e363..960fa1d3da 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -1241,6 +1241,19 @@ list_fn(const char *name, uint32 type, const char *comment, void *state)
}
+static void
+dir_list_fn(file_info *finfo, const char *mask, void *state)
+{
+
+ fprintf(stderr, "Finfo->name=%s, mask=%s\n", finfo->name, mask);
+ if (add_dirent((struct smbc_file *)state, finfo->name, "", SMBC_FILE) < 0) {
+
+ /* Handle an error ... */
+
+ }
+
+}
+
int smbc_opendir(const char *fname)
{
struct in_addr addr;
@@ -1447,8 +1460,35 @@ int smbc_opendir(const char *fname)
}
else { /* The server and share are specified ... work from there ... */
+ /* Well, we connect to the server and list the directory */
+
+ smbc_file_table[slot]->dir_type = SMBC_FILE_SHARE;
+
+ srv = smbc_server(server, share);
+ if (!srv) {
+ if (smbc_file_table[slot]) free(smbc_file_table[slot]);
+ smbc_file_table[slot] = NULL;
+ return -1;
+
+ }
+
+ smbc_file_table[slot]->srv = srv;
+
+ /* Now, list the files ... */
+
+ pstrcat(path, "\\*");
+
+ if (!cli_list(&srv->cli, path, aDIR | aSYSTEM | aHIDDEN, dir_list_fn,
+ (void *)smbc_file_table[slot])) {
+
+ if (smbc_file_table[slot]) free(smbc_file_table[slot]);
+ smbc_file_table[slot] = NULL;
+ errno = smbc_errno(&srv->cli);
+ return -1;
+
+ }
}
}