]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/cifs/connect.c
cifs: update for new IP4/6 address printing
[linux-2.6-omap-h63xx.git] / fs / cifs / connect.c
index 3a84a375cb6f4d535443232ed0ae408611a917d6..e9ea394ee075d0ef20ab7900d111c5bd6a6e20c6 100644 (file)
@@ -823,8 +823,8 @@ cifs_parse_mount_options(char *options, const char *devname,
        /* null target name indicates to use *SMBSERVR default called name
           if we end up sending RFC1001 session initialize */
        vol->target_rfc1001_name[0] = 0;
-       vol->linux_uid = current->uid;  /* current->euid instead? */
-       vol->linux_gid = current->gid;
+       vol->linux_uid = current_uid();  /* use current_euid() instead? */
+       vol->linux_gid = current_gid();
        vol->dir_mode = S_IRWXUGO;
        /* 2767 perms indicate mandatory locking support */
        vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP);
@@ -2270,11 +2270,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                /* new SMB session uses our srvTcp ref */
                pSesInfo->server = srvTcp;
                if (srvTcp->addr.sockAddr6.sin6_family == AF_INET6)
-                       sprintf(pSesInfo->serverName, NIP6_FMT,
-                               NIP6(srvTcp->addr.sockAddr6.sin6_addr));
+                       sprintf(pSesInfo->serverName, "%pI6",
+                               &srvTcp->addr.sockAddr6.sin6_addr);
                else
-                       sprintf(pSesInfo->serverName, NIPQUAD_FMT,
-                               NIPQUAD(srvTcp->addr.sockAddr.sin_addr.s_addr));
+                       sprintf(pSesInfo->serverName, "%pI4",
+                               &srvTcp->addr.sockAddr.sin_addr.s_addr);
 
                write_lock(&cifs_tcp_ses_lock);
                list_add(&pSesInfo->smb_ses_list, &srvTcp->smb_ses_list);
@@ -2282,9 +2282,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
 
                /* volume_info->password freed at unmount */
                if (volume_info->password) {
-                       pSesInfo->password = volume_info->password;
-                       /* set to NULL to prevent freeing on exit */
-                       volume_info->password = NULL;
+                       pSesInfo->password = kstrdup(volume_info->password,
+                                                    GFP_KERNEL);
+                       if (!pSesInfo->password) {
+                               rc = -ENOMEM;
+                               goto mount_fail_check;
+                       }
                }
                if (volume_info->username)
                        strncpy(pSesInfo->userName, volume_info->username,
@@ -2324,7 +2327,16 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                                rc = -ENOMEM;
                                goto mount_fail_check;
                        }
+
                        tcon->ses = pSesInfo;
+                       if (volume_info->password) {
+                               tcon->password = kstrdup(volume_info->password,
+                                                        GFP_KERNEL);
+                               if (!tcon->password) {
+                                       rc = -ENOMEM;
+                                       goto mount_fail_check;
+                               }
+                       }
 
                        /* check for null share name ie connect to dfs root */
                        if ((strchr(volume_info->UNC + 3, '\\') == NULL)
@@ -3532,15 +3544,14 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
                   NTLMv2 password here) */
 #ifdef CONFIG_CIFS_WEAK_PW_HASH
                if ((extended_security & CIFSSEC_MAY_LANMAN) &&
-                       (ses->server->secType == LANMAN))
-                       calc_lanman_hash(ses->password, ses->server->cryptKey,
+                   (ses->server->secType == LANMAN))
+                       calc_lanman_hash(tcon->password, ses->server->cryptKey,
                                         ses->server->secMode &
                                            SECMODE_PW_ENCRYPT ? true : false,
                                         bcc_ptr);
                else
 #endif /* CIFS_WEAK_PW_HASH */
-               SMBNTencrypt(ses->password,
-                            ses->server->cryptKey,
+               SMBNTencrypt(tcon->password, ses->server->cryptKey,
                             bcc_ptr);
 
                bcc_ptr += CIFS_SESS_KEY_SIZE;