summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2001-03-06 14:00:48 +0000
committerRichard Sharpe <sharpe@samba.org>2001-03-06 14:00:48 +0000
commit5bf5952fd68f7801e66ece29ccf4b0d5baa26c79 (patch)
tree0d8db7e764316ea5c5798ec9f3e02c2d730a41ab /source3/libsmb
parent134c0d27cce4a6912212770f645a46a22e204ad6 (diff)
downloadsamba-5bf5952fd68f7801e66ece29ccf4b0d5baa26c79.tar.gz
samba-5bf5952fd68f7801e66ece29ccf4b0d5baa26c79.tar.bz2
samba-5bf5952fd68f7801e66ece29ccf4b0d5baa26c79.zip
Implement smbc_lseekdir, but it will have to change ... because it has the
wrong interface defn. (This used to be commit 317e369c3e20206c9f8b36a91dc666ebeede68ec)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/libsmbclient.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 410e2ebdd6..770be06fda 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -2098,12 +2098,44 @@ off_t smbc_telldir(int fd)
}
/*
+ * A routine to run down the list and see if the entry is OK
+ */
+
+struct smbc_dir_list *smbc_check_dir_ent(struct smbc_dir_list *list,
+ struct smbc_dirent *dirent)
+{
+
+ /* Run down the list looking for what we want */
+
+ if (dirent) {
+
+ struct smbc_dir_list *tmp = list;
+
+ while (tmp) {
+
+ if (tmp->dirent == dirent)
+ return tmp;
+
+ tmp = tmp->next;
+
+ }
+
+ }
+
+ return NULL; /* Not found, or an error */
+
+}
+
+
+/*
* Routine to seek on a directory
*/
int smbc_lseekdir(int fd, off_t offset, int whence)
{
struct smbc_file *fe;
+ struct smbc_dirent *dirent = (struct smbc_dirent *)whence;
+ struct smbc_dir_list *list_ent = NULL;
if (!smbc_initialized) {
@@ -2137,7 +2169,26 @@ int smbc_lseekdir(int fd, off_t offset, int whence)
/* Now, check what we were passed and see if it is OK ... */
- return ENOSYS; /* Not implemented so far ... */
+ if (!whence) {
+
+ errno = EINVAL;
+ return -1;
+
+ }
+
+ /* Now, run down the list and make sure that the entry is OK */
+ /* This may need to be changed if we change the format of the list */
+
+ if ((list_ent = smbc_check_dir_ent(fe->dir_list, dirent)) == NULL) {
+
+ errno = EINVAL; /* Bad entry */
+ return -1;
+
+ }
+
+ fe->dir_next = list_ent;
+
+ return 0;
}