[PATCH] - NetConnEnum implementation

Shekhar Amlekar samlekar at in.ibm.com
Wed Apr 2 03:18:36 MDT 2014


Hi Jeremy,

Attached is the patchset with your comment incorporated. Pls let me know 
if you've further comments.

regards,
shekhar.



Jeremy Allison <jra at samba.org> wrote on 04/01/2014 05:07:00 AM:

> From: Jeremy Allison <jra at samba.org>
> To: Shekhar Amlekar/India/IBM at IBMIN, 
> Cc: samba-technical at lists.samba.org
> Date: 04/01/2014 05:05 AM
> Subject: Re: [PATCH] - NetConnEnum implementation
> 
> On Tue, Mar 25, 2014 at 06:07:50PM +0530, Shekhar Amlekar wrote:
> > Hi,
> > 
> > Please find attached patches that implement the NetConnEnum 
functionality 
> > for computing share connections.
> > 
> > Some background - while using MMC to delete a share, MMC uses 
NetConnEnum 
> > call to query the server to find out the active share connections. If 
> > there are some, a prompt is displayed to the administrator that asks 
for 
> > confirmation of share deletion. Since Samba does not implement this 
call, 
> > a prompt is displayed every time and the information about active 
share 
> > connections is not provided to the admin. Hence, the need for this 
> > implementation.
> > 
> > A comment about the implementation. Since the locking tdb does not 
store 
> > the share name or number, and changing tdb format is lot more work, 
the 
> > following implementation is an approximation. However, it does provide 

> > important information on share connections and open files to the 
> > administrator, and also gets rid of the false prompt.
> > 
> > 0001 - Added routines to count share connections.
> 
> In 0001 - Added routines to count share connections.
> 
> 
+/****************************************************************************
> + process an entry from the connection db.
> 
+****************************************************************************/
> +
> +static int share_conn_fn(struct smbXsrv_tcon_global0 *tcon,
> +                        void *data)
> +{
> +       struct share_conn_stat *scs = data;
> +
> +       if (!process_exists(tcon->server_id)) {
> +               return 0;
> +       }
> +
> +       if (strequal(tcon->share_name, scs->sharename)) {
> +               scs->count++;
> +               scs->svrid_arr = talloc_realloc(scs->ctx, 
scs->svrid_arr,
> +                                               struct server_id, 
scs->count);
> +               scs->svrid_arr[scs->count-1] = tcon->server_id;
> +       }
> +
> +       return 0;
> +}
> +
> 
> talloc_realloc needs a NULL check afterwards. Please fix and repost
> the entire patchset. Seems ok to me but I'll re-review the repost.
> 
> Cheers,
> 
>    Jeremy.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-rpc_server-srvsvc-Added-routines-to-count-share-c.patch
Type: application/octet-stream
Size: 2828 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140402/618bd500/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-s3-rpc_server-srvsvc-count-open-files-in-NetConnEnum.patch
Type: application/octet-stream
Size: 2857 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140402/618bd500/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-s3-rpc_server-srvsvc-count-share-connections-in-NetC.patch
Type: application/octet-stream
Size: 3082 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140402/618bd500/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s3-rpc_server-srvsvc-added-routines-to-compute-opens.patch
Type: application/octet-stream
Size: 2688 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140402/618bd500/attachment-0003.obj>


More information about the samba-technical mailing list