summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmbclient.c
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2001-02-19 05:50:09 +0000
committerRichard Sharpe <sharpe@samba.org>2001-02-19 05:50:09 +0000
commit2e99f0f8d31eb1e9ff518df17be30205752b17cd (patch)
tree9d35f241a1a8114b78fa38e6129f2d983b03bbbb /source3/libsmb/libsmbclient.c
parent0ea6c2473b06a1fa1db58d922d73ac739c486830 (diff)
downloadsamba-2e99f0f8d31eb1e9ff518df17be30205752b17cd.tar.gz
samba-2e99f0f8d31eb1e9ff518df17be30205752b17cd.tar.bz2
samba-2e99f0f8d31eb1e9ff518df17be30205752b17cd.zip
Opps, last one did not commit the correct changes ... Here they are.
This now uses a lookup on <DOMAIN><1D> and then does a name status query to the IP address returned to find the name of the server. Seems to work well against Samba, Win9X, WinNT and Win2K. (This used to be commit debb723194f903c7b3af61f93949df062985e218)
Diffstat (limited to 'source3/libsmb/libsmbclient.c')
-rw-r--r--source3/libsmb/libsmbclient.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 67d5b92100..1444e5883a 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -1471,7 +1471,7 @@ static void
dir_list_fn(file_info *finfo, const char *mask, void *state)
{
- fprintf(stderr, "Finfo->name=%s, mask=%s\n", finfo->name, mask);
+ /* fprintf(stderr, "Finfo->name=%s, mask=%s, mode=%0X\n", finfo->name, mask, finfo->mode);*/
if (add_dirent((struct smbc_file *)state, finfo->name, "",
(finfo->mode&aDIR?SMBC_DIR:SMBC_FILE)) < 0) {
@@ -1561,14 +1561,30 @@ int smbc_opendir(const char *fname)
/* We have server and share and path empty ... so list the workgroups */
- /* fprintf(stderr, "Workgroup is: %s\n", lp_workgroup()); */
- cli_get_backup_server(my_netbios_name, lp_workgroup(), server, sizeof(server));
+ /*cli_get_backup_server(my_netbios_name, lp_workgroup(), server, sizeof(server));*/
+
+ if (!resolve_name(lp_workgroup(), &rem_ip, 0x1d)) {
+
+ errno = EINVAL; /* Something wrong with smb.conf? */
+ return -1;
+
+ }
smbc_file_table[slot]->dir_type = SMBC_WORKGROUP;
- /*
- * Get a connection to IPC$ on the server if we do not already have one
- */
+ /* find the name of the server ... */
+
+ if (!name_status_find(0, rem_ip, server)) {
+
+ fprintf(stderr, "Could not get the name of local master browser ...\n");
+ errno = EINVAL;
+ return -1;
+
+ }
+
+ /*
+ * Get a connection to IPC$ on the server if we do not already have one
+ */
srv = smbc_server(server, "IPC$", lp_workgroup(), user, password);
@@ -1618,7 +1634,15 @@ int smbc_opendir(const char *fname)
* Get the backup list ...
*/
- cli_get_backup_server(my_netbios_name, server, buserver, sizeof(buserver));
+ /*cli_get_backup_server(my_netbios_name, server, buserver, sizeof(buserver)); */
+
+ if (!name_status_find(0, rem_ip, buserver)) {
+
+ fprintf(stderr, "Could not get name of local master browser ...\n");
+ errno = EPERM; /* FIXME, is this correct */
+ return -1;
+
+ }
/*
* Get a connection to IPC$ on the server if we do not already have one