[PATCH] Fix for bug 11550: smbstatus doesn't show named streams info

Jeremy Allison jra at samba.org
Mon Oct 12 19:10:58 UTC 2015


On Mon, Oct 12, 2015 at 01:12:55PM +0200, Ralph Boehme wrote:
> On Mon, Oct 12, 2015 at 01:07:08PM +0200, Ralph Boehme wrote:
> > Hi,
> > 
> > attached is a patch for bug 11550.
> > 
> > Please review & push if ok. Thanks!
> 
> here it is.

LGTM - pushed !

> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de,mailto:kontakt@sernet.de

> From 5508e436b114d4d4f409c14755705a91bc8aaf60 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Sun, 11 Oct 2015 09:38:18 +0200
> Subject: [PATCH] s3:smbstatus: add stream name to share_entry_forall()
> 
> Add stream name argument to share_entry_forall machinery so smbstatus
> can print the stream name of a file.
> 
> Bug: https://bugzilla.samba.org/show_bug.cgi?id=11550
> 
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  source3/locking/proto.h                   |  3 ++-
>  source3/locking/share_mode_lock.c         | 11 ++++++++---
>  source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 21 +++++++++++++++------
>  source3/utils/status.c                    |  6 +++++-
>  4 files changed, 30 insertions(+), 11 deletions(-)
> 
> diff --git a/source3/locking/proto.h b/source3/locking/proto.h
> index 652ec2a..8ff1c7c 100644
> --- a/source3/locking/proto.h
> +++ b/source3/locking/proto.h
> @@ -202,7 +202,8 @@ int share_mode_forall(int (*fn)(struct file_id fid,
>  				const struct share_mode_data *data,
>  				void *private_data),
>  		      void *private_data);
> -int share_entry_forall(int (*fn)(const struct share_mode_entry *, const char *,
> +int share_entry_forall(int (*fn)(const struct share_mode_entry *,
> +				 const char *, const char *,
>  				 const char *, void *),
>  		      void *private_data);
>  bool share_mode_cleanup_disconnected(struct file_id id,
> diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
> index 5eedcc5..6273aec 100644
> --- a/source3/locking/share_mode_lock.c
> +++ b/source3/locking/share_mode_lock.c
> @@ -728,7 +728,9 @@ int share_mode_forall(int (*fn)(struct file_id fid,
>  
>  struct share_entry_forall_state {
>  	int (*fn)(const struct share_mode_entry *e,
> -		  const char *service_path, const char *base_name,
> +		  const char *service_path,
> +		  const char *base_name,
> +		  const char *stream_name,
>  		  void *private_data);
>  	void *private_data;
>  };
> @@ -744,7 +746,9 @@ static int share_entry_traverse_fn(struct file_id fid,
>  		int ret;
>  
>  		ret = state->fn(&data->share_modes[i],
> -				data->servicepath, data->base_name,
> +				data->servicepath,
> +				data->base_name,
> +				data->stream_name,
>  				state->private_data);
>  		if (ret != 0) {
>  			return ret;
> @@ -760,7 +764,8 @@ static int share_entry_traverse_fn(struct file_id fid,
>  ********************************************************************/
>  
>  int share_entry_forall(int (*fn)(const struct share_mode_entry *,
> -				 const char *, const char *, void *),
> +				 const char *, const char *,
> +				 const char *, void *),
>  		       void *private_data)
>  {
>  	struct share_entry_forall_state state = {
> diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
> index be79e6a..96c022b 100644
> --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
> +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
> @@ -80,7 +80,9 @@ struct share_conn_stat {
>  ********************************************************************/
>  
>  static int enum_file_fn(const struct share_mode_entry *e,
> -			const char *sharepath, const char *fname,
> +			const char *sharepath,
> +			const char *fname,
> +			const char *sname,
>  			void *private_data)
>  {
>  	struct file_enum_count *fenum =
> @@ -129,8 +131,9 @@ static int enum_file_fn(const struct share_mode_entry *e,
>  	if ( strcmp( fname, "." ) == 0 ) {
>  		fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath );
>  	} else {
> -		fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s",
> -				sharepath, fname );
> +		fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s%s",
> +					   sharepath, fname,
> +					   sname ? sname : "");
>  	}
>  	if (!fullpath) {
>  		return 0;
> @@ -829,7 +832,9 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p,
>   **********************************************************************/
>  
>  static int count_sess_files_fn(const struct share_mode_entry *e,
> -			       const char *sharepath, const char *fname,
> +			       const char *sharepath,
> +			       const char *fname,
> +			       const char *sname,
>  			       void *data)
>  {
>  	struct sess_file_info *info = data;
> @@ -954,7 +959,9 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p,
>   ********************************************************************/
>  
>  static int share_file_fn(const struct share_mode_entry *e,
> -			 const char *sharepath, const char *fname,
> +			 const char *sharepath,
> +			 const char *fname,
> +			 const char *sname,
>  			 void *data)
>  {
>  	struct share_file_stat *sfs = data;
> @@ -2692,7 +2699,9 @@ struct enum_file_close_state {
>  };
>  
>  static int enum_file_close_fn(const struct share_mode_entry *e,
> -			      const char *sharepath, const char *fname,
> +			      const char *sharepath,
> +			      const char *fname,
> +			      const char *sname,
>  			      void *private_data)
>  {
>  	char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
> diff --git a/source3/utils/status.c b/source3/utils/status.c
> index a22d05b..f81ab5f 100644
> --- a/source3/utils/status.c
> +++ b/source3/utils/status.c
> @@ -117,6 +117,7 @@ static bool Ucrit_addPid( struct server_id pid )
>  static int print_share_mode(const struct share_mode_entry *e,
>  			    const char *sharepath,
>  			    const char *fname,
> +			    const char *sname,
>  			    void *dummy)
>  {
>  	static int count;
> @@ -190,7 +191,10 @@ static int print_share_mode(const struct share_mode_entry *e,
>  			d_printf("NONE            ");
>  		}
>  
> -		d_printf(" %s   %s   %s",sharepath, fname, time_to_asc((time_t)e->time.tv_sec));
> +		d_printf(" %s   %s%s   %s",
> +			 sharepath, fname,
> +			 sname ? sname : "",
> +			 time_to_asc((time_t)e->time.tv_sec));
>  	}
>  
>  	return 0;
> -- 
> 2.1.0
> 




More information about the samba-technical mailing list