2 Unix SMB/CIFS implementation.
3 client connect/disconnect routines
4 Copyright (C) Andrew Tridgell 1994-1998
5 Copyright (C) Gerald (Jerry) Carter 2004
6 Copyright (C) Jeremy Allison 2007-2009
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "libsmb/libsmb.h"
24 #include "libsmb/clirap.h"
27 #include "libsmb/nmblib.h"
28 #include "../libcli/smb/smbXcli_base.h"
30 /********************************************************************
33 DFS paths are *always* of the form \server\share\<pathname> (the \ characters
34 are not C escaped here).
36 - but if we're using POSIX paths then <pathname> may contain
37 '/' separators, not '\\' separators. So cope with '\\' or '/'
38 as a separator when looking at the pathname part.... JRA.
39 ********************************************************************/
41 /********************************************************************
42 Ensure a connection is encrypted.
43 ********************************************************************/
45 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
49 const char *sharename)
51 NTSTATUS status = cli_force_encryption(c,
56 if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_SUPPORTED)) {
57 d_printf("Encryption required and "
58 "server that doesn't support "
59 "UNIX extensions - failing connect\n");
60 } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNKNOWN_REVISION)) {
61 d_printf("Encryption required and "
62 "can't get UNIX CIFS extensions "
63 "version from server.\n");
64 } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNSUPPORTED_COMPRESSION)) {
65 d_printf("Encryption required and "
66 "share %s doesn't support "
67 "encryption.\n", sharename);
68 } else if (!NT_STATUS_IS_OK(status)) {
69 d_printf("Encryption required and "
70 "setup failed with error %s.\n",
77 /********************************************************************
78 Return a connection to a server.
79 ********************************************************************/
81 static NTSTATUS do_connect(TALLOC_CTX *ctx,
84 const struct user_auth_info *auth_info,
90 struct cli_state **pcli)
92 struct cli_state *c = NULL;
95 char *newserver, *newshare;
101 /* make a copy so we don't modify the global string 'service' */
102 servicename = talloc_strdup(ctx,share);
104 return NT_STATUS_NO_MEMORY;
106 sharename = servicename;
107 if (*sharename == '\\') {
109 if (server == NULL) {
112 sharename = strchr_m(sharename,'\\');
114 return NT_STATUS_NO_MEMORY;
119 if (server == NULL) {
120 return NT_STATUS_INVALID_PARAMETER;
123 if (get_cmdline_auth_info_use_kerberos(auth_info)) {
124 flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
126 if (get_cmdline_auth_info_fallback_after_kerberos(auth_info)) {
127 flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
129 if (get_cmdline_auth_info_use_ccache(auth_info)) {
130 flags |= CLI_FULL_CONNECTION_USE_CCACHE;
132 if (get_cmdline_auth_info_use_pw_nt_hash(auth_info)) {
133 flags |= CLI_FULL_CONNECTION_USE_NT_HASH;
136 status = cli_connect_nb(
137 server, NULL, port, name_type, NULL,
138 get_cmdline_auth_info_signing_state(auth_info),
141 if (!NT_STATUS_IS_OK(status)) {
142 d_printf("Connection to %s failed (Error %s)\n",
148 if (max_protocol == 0) {
149 max_protocol = PROTOCOL_NT1;
151 DEBUG(4,(" session request ok\n"));
153 status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE,
156 if (!NT_STATUS_IS_OK(status)) {
157 d_printf("protocol negotiation failed: %s\n",
163 username = get_cmdline_auth_info_username(auth_info);
164 password = get_cmdline_auth_info_password(auth_info);
166 status = cli_session_setup(c, username,
167 password, strlen(password),
168 password, strlen(password),
170 if (!NT_STATUS_IS_OK(status)) {
171 /* If a password was not supplied then
172 * try again with a null username. */
173 if (password[0] || !username[0] ||
174 get_cmdline_auth_info_use_kerberos(auth_info) ||
175 !NT_STATUS_IS_OK(status = cli_session_setup(c, "",
179 d_printf("session setup failed: %s\n",
181 if (NT_STATUS_EQUAL(status,
182 NT_STATUS_MORE_PROCESSING_REQUIRED))
183 d_printf("did you forget to run kinit?\n");
187 d_printf("Anonymous login successful\n");
188 status = cli_init_creds(c, "", lp_workgroup(), "");
190 status = cli_init_creds(c, username, lp_workgroup(), password);
193 if (!NT_STATUS_IS_OK(status)) {
194 DEBUG(10,("cli_init_creds() failed: %s\n", nt_errstr(status)));
199 if ( show_sessetup ) {
200 if (*c->server_domain) {
201 DEBUG(0,("Domain=[%s] OS=[%s] Server=[%s]\n",
202 c->server_domain,c->server_os,c->server_type));
203 } else if (*c->server_os || *c->server_type) {
204 DEBUG(0,("OS=[%s] Server=[%s]\n",
205 c->server_os,c->server_type));
208 DEBUG(4,(" session setup ok\n"));
210 /* here's the fun part....to support 'msdfs proxy' shares
211 (on Samba or windows) we have to issues a TRANS_GET_DFS_REFERRAL
212 here before trying to connect to the original share.
213 cli_check_msdfs_proxy() will fail if it is a normal share. */
215 if ((smb1cli_conn_capabilities(c->conn) & CAP_DFS) &&
216 cli_check_msdfs_proxy(ctx, c, sharename,
217 &newserver, &newshare,
223 return do_connect(ctx, newserver,
224 newshare, auth_info, false,
225 force_encrypt, max_protocol,
226 port, name_type, pcli);
229 /* must be a normal share */
231 status = cli_tree_connect(c, sharename, "?????",
232 password, strlen(password)+1);
233 if (!NT_STATUS_IS_OK(status)) {
234 d_printf("tree connect failed: %s\n", nt_errstr(status));
239 status = cli_tree_connect(c, sharename, "?????",
240 password, strlen(password)+1);
241 if (!NT_STATUS_IS_OK(status)) {
242 d_printf("tree connect failed: %s\n", nt_errstr(status));
248 status = cli_cm_force_encryption(c,
253 if (!NT_STATUS_IS_OK(status)) {
259 DEBUG(4,(" tconx ok\n"));
264 /****************************************************************************
265 ****************************************************************************/
267 static void cli_set_mntpoint(struct cli_state *cli, const char *mnt)
269 char *name = clean_name(NULL, mnt);
273 TALLOC_FREE(cli->dfs_mountpoint);
274 cli->dfs_mountpoint = talloc_strdup(cli, name);
278 /********************************************************************
279 Add a new connection to the list.
280 referring_cli == NULL means a new initial connection.
281 ********************************************************************/
283 static NTSTATUS cli_cm_connect(TALLOC_CTX *ctx,
284 struct cli_state *referring_cli,
287 const struct user_auth_info *auth_info,
293 struct cli_state **pcli)
295 struct cli_state *cli;
298 status = do_connect(ctx, server, share,
300 show_hdr, force_encrypt, max_protocol,
301 port, name_type, &cli);
303 if (!NT_STATUS_IS_OK(status)) {
307 /* Enter into the list. */
309 DLIST_ADD_END(referring_cli, cli, struct cli_state *);
312 if (referring_cli && referring_cli->requested_posix_capabilities) {
314 uint32 caplow, caphigh;
315 status = cli_unix_extensions_version(cli, &major, &minor,
317 if (NT_STATUS_IS_OK(status)) {
318 cli_set_unix_extensions_capabilities(cli,
328 /********************************************************************
329 Return a connection to a server on a particular share.
330 ********************************************************************/
332 static struct cli_state *cli_cm_find(struct cli_state *cli,
342 /* Search to the start of the list. */
343 for (p = cli; p; p = DLIST_PREV(p)) {
344 const char *remote_name =
345 smbXcli_conn_remote_name(p->conn);
347 if (strequal(server, remote_name) &&
348 strequal(share,p->share)) {
353 /* Search to the end of the list. */
354 for (p = cli->next; p; p = p->next) {
355 const char *remote_name =
356 smbXcli_conn_remote_name(p->conn);
358 if (strequal(server, remote_name) &&
359 strequal(share,p->share)) {
367 /****************************************************************************
368 Open a client connection to a \\server\share.
369 ****************************************************************************/
371 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
372 struct cli_state *referring_cli,
375 const struct user_auth_info *auth_info,
381 struct cli_state **pcli)
383 /* Try to reuse an existing connection in this list. */
384 struct cli_state *c = cli_cm_find(referring_cli, server, share);
392 if (auth_info == NULL) {
393 /* Can't do a new connection
394 * without auth info. */
395 d_printf("cli_cm_open() Unable to open connection [\\%s\\%s] "
396 "without auth info\n",
398 return NT_STATUS_INVALID_PARAMETER;
401 status = cli_cm_connect(ctx,
412 if (!NT_STATUS_IS_OK(status)) {
419 /****************************************************************************
420 ****************************************************************************/
422 void cli_cm_display(struct cli_state *cli)
426 for (i=0; cli; cli = cli->next,i++ ) {
427 d_printf("%d:\tserver=%s, share=%s\n",
428 i, smbXcli_conn_remote_name(cli->conn), cli->share);
432 /****************************************************************************
433 ****************************************************************************/
435 /****************************************************************************
436 ****************************************************************************/
439 void cli_cm_set_credentials(struct user_auth_info *auth_info)
441 SAFE_FREE(cm_creds.username);
442 cm_creds.username = SMB_STRDUP(get_cmdline_auth_info_username(
445 if (get_cmdline_auth_info_got_pass(auth_info)) {
446 cm_set_password(get_cmdline_auth_info_password(auth_info));
449 cm_creds.use_kerberos = get_cmdline_auth_info_use_kerberos(auth_info);
450 cm_creds.fallback_after_kerberos = false;
451 cm_creds.signing_state = get_cmdline_auth_info_signing_state(auth_info);
455 /**********************************************************************
456 split a dfs path into the server, share name, and extrapath components
457 **********************************************************************/
459 static bool split_dfs_path(TALLOC_CTX *ctx,
460 const char *nodepath,
470 *pp_extrapath = NULL;
472 path = talloc_strdup(ctx, nodepath);
477 if ( path[0] != '\\' ) {
481 p = strchr_m( path + 1, '\\' );
489 /* Look for any extra/deep path */
490 q = strchr_m(p, '\\');
494 *pp_extrapath = talloc_strdup(ctx, q);
496 *pp_extrapath = talloc_strdup(ctx, "");
498 if (*pp_extrapath == NULL) {
502 *pp_share = talloc_strdup(ctx, p);
503 if (*pp_share == NULL) {
507 *pp_server = talloc_strdup(ctx, &path[1]);
508 if (*pp_server == NULL) {
516 TALLOC_FREE(*pp_share);
517 TALLOC_FREE(*pp_extrapath);
522 /****************************************************************************
523 Return the original path truncated at the directory component before
524 the first wildcard character. Trust the caller to provide a NULL
526 ****************************************************************************/
528 static char *clean_path(TALLOC_CTX *ctx, const char *path)
534 /* No absolute paths. */
535 while (IS_DIRECTORY_SEP(*path)) {
539 path_out = talloc_strdup(ctx, path);
544 p1 = strchr_m(path_out, '*');
545 p2 = strchr_m(path_out, '?');
557 /* Now go back to the start of this component. */
558 p1 = strrchr_m(path_out, '/');
559 p2 = strrchr_m(path_out, '\\');
566 /* Strip any trailing separator */
568 len = strlen(path_out);
569 if ( (len > 0) && IS_DIRECTORY_SEP(path_out[len-1])) {
570 path_out[len-1] = '\0';
576 /****************************************************************************
577 ****************************************************************************/
579 static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
580 struct cli_state *cli,
583 char path_sep = '\\';
585 /* Ensure the extrapath doesn't start with a separator. */
586 while (IS_DIRECTORY_SEP(*dir)) {
590 if (cli->requested_posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
593 return talloc_asprintf(ctx, "%c%s%c%s%c%s",
595 smbXcli_conn_remote_name(cli->conn),
602 /********************************************************************
603 check for dfs referral
604 ********************************************************************/
606 static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected,
609 /* only deal with DS when we negotiated NT_STATUS codes and UNICODE */
611 if (!(smb1cli_conn_capabilities(cli->conn) & CAP_UNICODE)) {
614 if (!(smb1cli_conn_capabilities(cli->conn) & CAP_STATUS32)) {
617 if (NT_STATUS_EQUAL(status, expected)) {
623 /********************************************************************
624 Get the dfs referral link.
625 ********************************************************************/
627 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
628 struct cli_state *cli,
630 struct client_dfs_referral **refs,
634 unsigned int data_len = 0;
635 unsigned int param_len = 0;
637 uint16_t recv_flags2;
638 uint8_t *param = NULL;
639 uint8_t *rdata = NULL;
642 smb_ucs2_t *path_ucs;
643 char *consumed_path = NULL;
644 uint16_t consumed_ucs;
645 uint16 num_referrals;
646 struct client_dfs_referral *referrals = NULL;
648 TALLOC_CTX *frame = talloc_stackframe();
653 SSVAL(setup, 0, TRANSACT2_GET_DFS_REFERRAL);
655 param = talloc_array(talloc_tos(), uint8_t, 2);
657 status = NT_STATUS_NO_MEMORY;
660 SSVAL(param, 0, 0x03); /* max referral level */
662 param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
663 path, strlen(path)+1,
666 status = NT_STATUS_NO_MEMORY;
669 param_len = talloc_get_size(param);
670 path_ucs = (smb_ucs2_t *)¶m[2];
672 status = cli_trans(talloc_tos(), cli, SMBtrans2,
676 NULL, 0, CLI_BUFFER_SIZE,
678 NULL, 0, NULL, /* rsetup */
680 &rdata, 4, &data_len);
681 if (!NT_STATUS_IS_OK(status)) {
685 endp = (char *)rdata + data_len;
687 consumed_ucs = SVAL(rdata, 0);
688 num_referrals = SVAL(rdata, 2);
690 /* consumed_ucs is the number of bytes
691 * of the UCS2 path consumed not counting any
692 * terminating null. We need to convert
693 * back to unix charset and count again
694 * to get the number of bytes consumed from
695 * the incoming path. */
698 if (pull_string_talloc(talloc_tos(),
706 status = map_nt_error_from_unix(errno);
708 status = NT_STATUS_INVALID_NETWORK_RESPONSE;
712 if (consumed_path == NULL) {
713 status = map_nt_error_from_unix(errno);
716 *consumed = strlen(consumed_path);
718 if (num_referrals != 0) {
724 referrals = talloc_array(ctx, struct client_dfs_referral,
728 status = NT_STATUS_NO_MEMORY;
731 /* start at the referrals array */
734 for (i=0; i<num_referrals && p < endp; i++) {
738 ref_version = SVAL(p, 0);
739 ref_size = SVAL(p, 2);
740 node_offset = SVAL(p, 16);
742 if (ref_version != 3) {
747 referrals[i].proximity = SVAL(p, 8);
748 referrals[i].ttl = SVAL(p, 10);
750 if (p + node_offset > endp) {
751 status = NT_STATUS_INVALID_NETWORK_RESPONSE;
754 clistr_pull_talloc(referrals,
757 &referrals[i].dfspath,
759 PTR_DIFF(endp, p+node_offset),
760 STR_TERMINATE|STR_UNICODE);
762 if (!referrals[i].dfspath) {
763 status = map_nt_error_from_unix(errno);
768 if (i < num_referrals) {
769 status = NT_STATUS_INVALID_NETWORK_RESPONSE;
774 *num_refs = num_referrals;
783 /********************************************************************
784 ********************************************************************/
786 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
788 const struct user_auth_info *dfs_auth_info,
789 struct cli_state *rootcli,
791 struct cli_state **targetcli,
792 char **pp_targetpath)
794 struct client_dfs_referral *refs = NULL;
797 struct cli_state *cli_ipc = NULL;
798 char *dfs_path = NULL;
799 char *cleanpath = NULL;
800 char *extrapath = NULL;
804 struct cli_state *newcli = NULL;
805 char *newpath = NULL;
806 char *newmount = NULL;
808 SMB_STRUCT_STAT sbuf;
812 if ( !rootcli || !path || !targetcli ) {
813 return NT_STATUS_INVALID_PARAMETER;
816 /* Don't do anything if this is not a DFS root. */
818 if ( !rootcli->dfsroot) {
819 *targetcli = rootcli;
820 *pp_targetpath = talloc_strdup(ctx, path);
821 if (!*pp_targetpath) {
822 return NT_STATUS_NO_MEMORY;
829 /* Send a trans2_query_path_info to check for a referral. */
831 cleanpath = clean_path(ctx, path);
833 return NT_STATUS_NO_MEMORY;
836 dfs_path = cli_dfs_make_full_path(ctx, rootcli, cleanpath);
838 return NT_STATUS_NO_MEMORY;
841 status = cli_qpathinfo_basic( rootcli, dfs_path, &sbuf, &attributes);
842 if (NT_STATUS_IS_OK(status)) {
843 /* This is an ordinary path, just return it. */
844 *targetcli = rootcli;
845 *pp_targetpath = talloc_strdup(ctx, path);
846 if (!*pp_targetpath) {
847 return NT_STATUS_NO_MEMORY;
852 /* Special case where client asked for a path that does not exist */
854 if (cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND,
856 *targetcli = rootcli;
857 *pp_targetpath = talloc_strdup(ctx, path);
858 if (!*pp_targetpath) {
859 return NT_STATUS_NO_MEMORY;
864 /* We got an error, check for DFS referral. */
866 if (!cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED,
871 /* Check for the referral. */
873 status = cli_cm_open(ctx,
875 smbXcli_conn_remote_name(rootcli->conn),
879 smb1cli_conn_encryption_on(rootcli->conn),
880 smbXcli_conn_protocol(rootcli->conn),
884 if (!NT_STATUS_IS_OK(status)) {
888 status = cli_dfs_get_referral(ctx, cli_ipc, dfs_path, &refs,
889 &num_refs, &consumed);
890 if (!NT_STATUS_IS_OK(status) || !num_refs) {
894 /* Just store the first referral for now. */
896 if (!refs[0].dfspath) {
897 return NT_STATUS_NOT_FOUND;
899 if (!split_dfs_path(ctx, refs[0].dfspath, &server, &share,
901 return NT_STATUS_NOT_FOUND;
904 /* Make sure to recreate the original string including any wildcards. */
906 dfs_path = cli_dfs_make_full_path(ctx, rootcli, path);
908 return NT_STATUS_NO_MEMORY;
910 pathlen = strlen(dfs_path);
911 consumed = MIN(pathlen, consumed);
912 *pp_targetpath = talloc_strdup(ctx, &dfs_path[consumed]);
913 if (!*pp_targetpath) {
914 return NT_STATUS_NO_MEMORY;
916 dfs_path[consumed] = '\0';
919 * *pp_targetpath is now the unconsumed part of the path.
920 * dfs_path is now the consumed part of the path
921 * (in \server\share\path format).
924 /* Open the connection to the target server & share */
925 status = cli_cm_open(ctx, rootcli,
930 smb1cli_conn_encryption_on(rootcli->conn),
931 smbXcli_conn_protocol(rootcli->conn),
935 if (!NT_STATUS_IS_OK(status)) {
936 d_printf("Unable to follow dfs referral [\\%s\\%s]\n",
941 if (extrapath && strlen(extrapath) > 0) {
942 /* EMC Celerra NAS version 5.6.50 (at least) doesn't appear to */
943 /* put the trailing \ on the path, so to be save we put one in if needed */
944 if (extrapath[strlen(extrapath)-1] != '\\' && **pp_targetpath != '\\') {
945 *pp_targetpath = talloc_asprintf(ctx,
950 *pp_targetpath = talloc_asprintf(ctx,
955 if (!*pp_targetpath) {
956 return NT_STATUS_NO_MEMORY;
960 /* parse out the consumed mount path */
961 /* trim off the \server\share\ */
965 if (*ppath != '\\') {
966 d_printf("cli_resolve_path: "
967 "dfs_path (%s) not in correct format.\n",
969 return NT_STATUS_NOT_FOUND;
972 ppath++; /* Now pointing at start of server name. */
974 if ((ppath = strchr_m( dfs_path, '\\' )) == NULL) {
975 return NT_STATUS_NOT_FOUND;
978 ppath++; /* Now pointing at start of share name. */
980 if ((ppath = strchr_m( ppath+1, '\\' )) == NULL) {
981 return NT_STATUS_NOT_FOUND;
984 ppath++; /* Now pointing at path component. */
986 newmount = talloc_asprintf(ctx, "%s\\%s", mountpt, ppath );
988 return NT_STATUS_NOT_FOUND;
991 cli_set_mntpoint(*targetcli, newmount);
993 /* Check for another dfs referral, note that we are not
994 checking for loops here. */
996 if (!strequal(*pp_targetpath, "\\") && !strequal(*pp_targetpath, "/")) {
997 status = cli_resolve_path(ctx,
1004 if (NT_STATUS_IS_OK(status)) {
1006 * When cli_resolve_path returns true here it's always
1007 * returning the complete path in newpath, so we're done
1010 *targetcli = newcli;
1011 *pp_targetpath = newpath;
1018 /* If returning true ensure we return a dfs root full path. */
1019 if ((*targetcli)->dfsroot) {
1020 dfs_path = talloc_strdup(ctx, *pp_targetpath);
1022 return NT_STATUS_NO_MEMORY;
1024 *pp_targetpath = cli_dfs_make_full_path(ctx, *targetcli, dfs_path);
1025 if (*pp_targetpath == NULL) {
1026 return NT_STATUS_NO_MEMORY;
1030 return NT_STATUS_OK;
1033 /********************************************************************
1034 ********************************************************************/
1036 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
1037 struct cli_state *cli,
1038 const char *sharename,
1039 char **pp_newserver,
1042 const char *username,
1043 const char *password,
1046 struct client_dfs_referral *refs = NULL;
1047 size_t num_refs = 0;
1048 size_t consumed = 0;
1049 char *fullpath = NULL;
1052 char *newextrapath = NULL;
1054 const char *remote_name;
1056 if (!cli || !sharename) {
1060 remote_name = smbXcli_conn_remote_name(cli->conn);
1061 cnum = cli_state_get_tid(cli);
1063 /* special case. never check for a referral on the IPC$ share */
1065 if (strequal(sharename, "IPC$")) {
1069 /* send a trans2_query_path_info to check for a referral */
1071 fullpath = talloc_asprintf(ctx, "\\%s\\%s", remote_name, sharename);
1076 /* check for the referral */
1078 if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL, 0))) {
1082 if (force_encrypt) {
1083 status = cli_cm_force_encryption(cli,
1088 if (!NT_STATUS_IS_OK(status)) {
1093 status = cli_dfs_get_referral(ctx, cli, fullpath, &refs,
1094 &num_refs, &consumed);
1095 res = NT_STATUS_IS_OK(status);
1097 status = cli_tdis(cli);
1098 if (!NT_STATUS_IS_OK(status)) {
1102 cli_state_set_tid(cli, cnum);
1104 if (!res || !num_refs) {
1108 if (!refs[0].dfspath) {
1112 if (!split_dfs_path(ctx, refs[0].dfspath, pp_newserver,
1113 pp_newshare, &newextrapath)) {
1117 /* check that this is not a self-referral */
1119 if (strequal(remote_name, *pp_newserver) &&
1120 strequal(sharename, *pp_newshare)) {