* traversal via DFS junction point
*
* Copyright (c) 2007 Igor Mammedov
+ * Copyright (C) International Business Machines Corp., 2008
* Author(s): Igor Mammedov (niallain@gmail.com)
- *
+ * Steve French (sfrench@us.ibm.com)
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* Returns: pointer to new mount options or ERR_PTR.
* Caller is responcible for freeing retunrned value if it is not error.
*/
-char *compose_mount_options(const char *sb_mountdata, const char *ref_unc,
- char **devname)
+static char *compose_mount_options(const char *sb_mountdata,
+ const char *ref_unc,
+ char **devname)
{
int rc;
char *mountdata;
}
-struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
+static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
struct dentry *dentry, char *ref_unc)
{
struct cifs_sb_info *cifs_sb;
struct vfsmount *mnt;
char *mountdata;
- char *devname;
+ char *devname = NULL;
cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
mountdata = compose_mount_options(cifs_sb->mountdata,
return err;
}
-void dump_referral(const struct dfs_info3_param *ref)
+static void dump_referral(const struct dfs_info3_param *ref)
{
cFYI(1, ("DFS: ref path: %s", ref->path_name));
cFYI(1, ("DFS: node path: %s", ref->node_name));
/*
* fs/cifs/cifsglob.h
*
- * Copyright (C) International Business Machines Corp., 2002,2007
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org)
*
#define XATTR_DOS_ATTRIB "user.DOSATTRIB"
#endif
-/*
- * This information is kept on every Server we know about.
- *
- * Some things to note:
- *
- */
-#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1)
-
/*
* CIFS vfs client Status information (based on what we know.)
*/
struct file *pfile;
};
+struct dfs_info3_param {
+ int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/
+ int PathConsumed;
+ int server_type;
+ int ref_flag;
+ char *path_name;
+ char *node_name;
+};
+
+static inline void free_dfs_info_param(struct dfs_info3_param *param)
+{
+ if (param) {
+ kfree(param->path_name);
+ kfree(param->node_name);
+ kfree(param);
+ }
+}
+
+static inline void free_dfs_info_array(struct dfs_info3_param *param,
+ int number_of_items)
+{
+ int i;
+ if ((number_of_items == 0) || (param == NULL))
+ return;
+ for (i = 0; i < number_of_items; i++) {
+ kfree(param[i].path_name);
+ kfree(param[i].node_name);
+ }
+ kfree(param);
+}
+
#define MID_FREE 0
#define MID_REQUEST_ALLOCATED 1
#define MID_REQUEST_SUBMITTED 2
/*
* fs/cifs/cifsproto.h
*
- * Copyright (c) International Business Machines Corp., 2002,2007
+ * Copyright (c) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
const char *old_path,
const struct nls_table *nls_codepage,
unsigned int *pnum_referrals,
- unsigned char **preferrals,
+ struct dfs_info3_param **preferrals,
int remap);
extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
struct super_block *sb, struct smb_vol *vol);
/*
* fs/cifs/connect.c
*
- * Copyright (C) International Business Machines Corp., 2002,2007
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
const char *old_path, const struct nls_table *nls_codepage,
int remap)
{
- unsigned char *referrals = NULL;
+ struct dfs_info3_param *referrals = NULL;
unsigned int num_referrals;
int rc = 0;
int
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
const struct nls_table *nls_codepage, unsigned int *pnum_referrals,
- unsigned char **preferrals, int remap)
+ struct dfs_info3_param **preferrals, int remap)
{
char *temp_unc;
int rc = 0;
+ unsigned char *targetUNCs;
*pnum_referrals = 0;
+ *preferrals = NULL;
if (pSesInfo->ipc_tid == 0) {
temp_unc = kmalloc(2 /* for slashes */ +
kfree(temp_unc);
}
if (rc == 0)
- rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals,
+ rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, &targetUNCs,
pnum_referrals, nls_codepage, remap);
+ /* BB map targetUNCs to dfs_info3 structures, here or
+ in CIFSGetDFSRefer BB */
return rc;
}
* return 0 on success
*/
int
-dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) {
+dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
+{
int rc = -EAGAIN;
struct key *rkey;
char *name;
int len;
- if ((!ip_addr) || (!unc))
+ if (!ip_addr || !unc)
return -EINVAL;
/* search for server name delimiter */
/*
* fs/cifs/link.c
*
- * Copyright (C) International Business Machines Corp., 2002,2003
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
char *full_path = NULL;
char *tmp_path = NULL;
char *tmpbuffer;
- unsigned char *referrals = NULL;
- unsigned int num_referrals = 0;
int len;
__u16 fid;
cFYI(1, ("Error closing junction point "
"(open for ioctl)"));
}
+ /* BB unwind this long, nested function, or remove BB */
if (rc == -EIO) {
/* Query if DFS Junction */
+ unsigned int num_referrals = 0;
+ struct dfs_info3_param *refs = NULL;
tmp_path =
kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1,
GFP_KERNEL);
rc = get_dfs_path(xid, pTcon->ses,
tmp_path,
cifs_sb->local_nls,
- &num_referrals, &referrals,
+ &num_referrals, &refs,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("Get DFS for %s rc = %d ",
else {
cFYI(1, ("num referral: %d",
num_referrals));
- if (referrals) {
- cFYI(1,("referral string: %s", referrals));
+ if (refs && refs->path_name) {
strncpy(tmpbuffer,
- referrals,
+ refs->path_name,
len-1);
}
}
- kfree(referrals);
+ kfree(refs);
kfree(tmp_path);
}
/* BB add code like else decode referrals