svn commit: samba r5577 - in branches/SAMBA_3_0/source: client libsmb

jerry at samba.org jerry at samba.org
Sat Feb 26 14:42:56 GMT 2005


Author: jerry
Date: 2005-02-26 14:42:55 +0000 (Sat, 26 Feb 2005)
New Revision: 5577

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5577

Log:
get recurse; dir working across single level dfs referrals
Modified:
   branches/SAMBA_3_0/source/client/client.c
   branches/SAMBA_3_0/source/libsmb/clidfs.c
   branches/SAMBA_3_0/source/libsmb/clilist.c


Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SAMBA_3_0/source/client/client.c	2005-02-26 11:39:32 UTC (rev 5576)
+++ branches/SAMBA_3_0/source/client/client.c	2005-02-26 14:42:55 UTC (rev 5577)
@@ -509,7 +509,7 @@
  A helper for do_list.
 ****************************************************************************/
 
-static void do_list_helper(file_info *f, const char *mask, void *state)
+static void do_list_helper(const char *mntpoint, file_info *f, const char *mask, void *state)
 {
 	if (f->mode & aDIR) {
 		if (do_list_dirs && do_this_one(f)) {
@@ -526,7 +526,8 @@
 				return;
 			}
 
-			pstrcpy(mask2, mask);
+			pstrcpy(mask2, mntpoint);
+			pstrcat(mask2, mask);
 			p = strrchr_m(mask2,'\\');
 			if (!p)
 				return;
@@ -583,6 +584,7 @@
 			
 			if ( !cli_resolve_path( cli, head, &targetcli, targetpath ) ) {
 				d_printf("do_list: [%s] %s\n", head, cli_errstr(cli));
+				remove_do_list_queue_head();
 				continue;
 			}
 			
@@ -2871,7 +2873,7 @@
 	int len;
 } completion_remote_t;
 
-static void completion_remote_filter(file_info *f, const char *mask, void *state)
+static void completion_remote_filter(const char *mnt, file_info *f, const char *mask, void *state)
 {
 	completion_remote_t *info = (completion_remote_t *)state;
 

Modified: branches/SAMBA_3_0/source/libsmb/clidfs.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clidfs.c	2005-02-26 11:39:32 UTC (rev 5576)
+++ branches/SAMBA_3_0/source/libsmb/clidfs.c	2005-02-26 14:42:55 UTC (rev 5577)
@@ -27,6 +27,7 @@
 struct client_connection {
 	struct client_connection *prev, *next;
 	struct cli_state *cli;
+	pstring mount;
 };
 
 /* global state....globals reek! */
@@ -166,6 +167,54 @@
 	return c;
 }
 
+/****************************************************************************
+****************************************************************************/
+
+static void cli_cm_set_mntpoint( struct cli_state *c, const char *mnt )
+{
+	struct client_connection *p;
+	int i;
+	pstring path;
+	char *ppath;
+
+	for ( p=connections,i=0; p; p=p->next,i++ ) {
+		if ( strequal(p->cli->desthost, c->desthost) && strequal(p->cli->share, c->share) )
+			break;
+	}
+	
+	if ( p ) {
+		pstrcpy( p->mount, mnt );
+		dos_clean_name( p->mount );
+
+#if 0 
+		/* strip any leading '\\' */
+		ppath = path;
+		if ( *ppath == '\\' )
+			ppath++;
+		pstrcpy( p->mount, ppath );		
+#endif
+	}
+}
+
+/****************************************************************************
+****************************************************************************/
+
+const char * cli_cm_get_mntpoint( struct cli_state *c )
+{
+	struct client_connection *p;
+	int i;
+
+	for ( p=connections,i=0; p; p=p->next,i++ ) {
+		if ( strequal(p->cli->desthost, c->desthost) && strequal(p->cli->share, c->share) )
+			break;
+	}
+	
+	if ( p )
+		return p->mount;
+		
+	return NULL;
+}
+
 /********************************************************************
  Add a new connection to the list
 ********************************************************************/
@@ -186,6 +235,8 @@
 
 	DLIST_ADD( connections, node );
 
+	cli_cm_set_mntpoint( node->cli, "" );
+
 	return node->cli;
 
 }
@@ -585,6 +636,8 @@
 			
 		return False;
 	}
+	
+	cli_cm_set_mntpoint( *targetcli, cleanpath );
 
 	/* check for another dfs refeerrali, note that we are not 
 	   checking for loops here */

Modified: branches/SAMBA_3_0/source/libsmb/clilist.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clilist.c	2005-02-26 11:39:32 UTC (rev 5576)
+++ branches/SAMBA_3_0/source/libsmb/clilist.c	2005-02-26 14:42:55 UTC (rev 5577)
@@ -143,7 +143,7 @@
 ****************************************************************************/
 
 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, 
-		 void (*fn)(file_info *, const char *, void *), void *state)
+		 void (*fn)(const char *, file_info *, const char *, void *), void *state)
 {
 #if 0
 	int max_matches = 1366; /* Match W2k - was 512. */
@@ -322,8 +322,11 @@
 	}
 
 	for (p=dirlist,i=0;i<total_received;i++) {
+		const char *mnt = cli_cm_get_mntpoint( cli );
+		
 		p += interpret_long_filename(cli,info_level,p,&finfo);
-		fn(&finfo, Mask, state);
+		
+		fn( mnt,&finfo, Mask, state );
 	}
 
 	/* free up the dirlist buffer */
@@ -365,7 +368,7 @@
 ****************************************************************************/
 
 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, 
-		 void (*fn)(file_info *, const char *, void *), void *state)
+		 void (*fn)(const char *, file_info *, const char *, void *), void *state)
 {
 	char *p;
 	int received = 0;
@@ -472,7 +475,7 @@
 	for (p=dirlist,i=0;i<num_received;i++) {
 		file_info finfo;
 		p += interpret_short_filename(cli, p,&finfo);
-		fn(&finfo, Mask, state);
+		fn("\\", &finfo, Mask, state);
 	}
 
 	SAFE_FREE(dirlist);
@@ -485,7 +488,7 @@
 ****************************************************************************/
 
 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, 
-	     void (*fn)(file_info *, const char *, void *), void *state)
+	     void (*fn)(const char *, file_info *, const char *, void *), void *state)
 {
 	if (cli->protocol <= PROTOCOL_LANMAN1)
 		return cli_list_old(cli, Mask, attribute, fn, state);



More information about the samba-cvs mailing list