[Samba] libsmbclient - detect own workgroup
Gerd Fleischer
gerdfleischer at gmx.de
Thu Oct 13 17:56:48 GMT 2005
Thanks for your answers.
Am Donnerstag, 13. Oktober 2005 17:32 schrieb derrell at samba.org:
> "Gerald (Jerry) Carter" <jerry at samba.org> writes:
> > Gerd Fleischer wrote:
> > | Hi,
> > |
> > | I would like to know if there's a way to detect the
> > | workgroup of my own server with libsmbclient.
> > |
> > | With earlier versions than 3.0.20 it was possible
> > | to use smbctx->workgroup after the context was
> > | initialized. Since 3.0.15pre2 or so its always "WORKGROUP".
> > | Am I missing something?
> >
> The fix for bug 1133 added reading a new configuration file but "should"
> not have affected previous operation.
>
> The value of smbctx->workgroup is set from within smbc_init_context() which
> is occasionally called explicitly (and it sounds like you're doing that),
> or is called by smbc_init().
You're right. I'm doing the following:
smbCtx = smbc_new_context();
if (smbCtx) {
smbCtx->callbacks.auth_fn = makePopup::auth_smbc_get_data;
smbCtx->timeout = 2000; // any effect?
#ifdef HAVE_SMBCCTX_OPTIONS
smbCtx->options.urlencode_readdir_entries = 1;
#endif
smbCtx = smbc_init_context(smbCtx);
and it used to work with prior samba versions, but may not be correct.
I use smbc_init_context directly as I needed a pointer to a context so I can
get the hostname and workgroup with
smbCtx->netbios_name and smbCtx->workgroup.
>
> The value of smbctx->workgroup should come from one of the following files:
>
> ${HOME}/.smb/smb.conf
> /etc/smb.conf (or wherever your global configuration file is)
> ${HOME}/.smb/smb.conf.append
I don't have a ${HOME}/.smb/smb.conf but in /etc/samba/smb.conf (SUSE) is a
workgroup = ... entry in [global]
MfG, Gerd
More information about the samba
mailing list