From d5bf33ec94b1ac1a6c08863bac39154f762f0810 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 17 Feb 2012 22:21:00 -0500 Subject: [PATCH] Windows: Explorer Shell Set Unix Mode bits The Unix Mode bits were not being saved. This patch permits them to be saved. FIXES 130572 Change-Id: I6bf96c04115ee0f01e84b44b9efaacb578d95cbc (cherry picked from commit 534d95ef90ac5e5ebf5deb227008e0b023e7ef8b) Reviewed-on: http://gerrit.openafs.org/6734 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/client_exp/PropFile.cpp | 48 +++++++++++++++++++-------------------- src/WINNT/client_exp/gui2fs.cpp | 26 ++++++++++----------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/WINNT/client_exp/PropFile.cpp b/src/WINNT/client_exp/PropFile.cpp index 8cb331a..759f1df 100644 --- a/src/WINNT/client_exp/PropFile.cpp +++ b/src/WINNT/client_exp/PropFile.cpp @@ -207,21 +207,21 @@ BOOL CPropFile::PropPageProc( HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lP void CPropFile::ShowUnixMode(const CString& strUserRights, const CString& strGroupRights, const CString& strOtherRights, const CString& strSuidRights) { - SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_READ, BM_SETCHECK, (strUserRights.Find(_T("r")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_WRITE, BM_SETCHECK, (strUserRights.Find(_T("w")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_EXECUTE, BM_SETCHECK, (strUserRights.Find(_T("x")) == -1) ? UNCHECKED : CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_READ, BM_SETCHECK, (strUserRights.Find(_T("r")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_WRITE, BM_SETCHECK, (strUserRights.Find(_T("w")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_EXECUTE, BM_SETCHECK, (strUserRights.Find(_T("x")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_READ, BM_SETCHECK, (strGroupRights.Find(_T("r")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_WRITE, BM_SETCHECK, (strGroupRights.Find(_T("w")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_EXECUTE, BM_SETCHECK, (strGroupRights.Find(_T("x")) == -1) ? UNCHECKED : CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_READ, BM_SETCHECK, (strGroupRights.Find(_T("r")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_WRITE, BM_SETCHECK, (strGroupRights.Find(_T("w")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_EXECUTE, BM_SETCHECK, (strGroupRights.Find(_T("x")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_READ, BM_SETCHECK, (strOtherRights.Find(_T("r")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_WRITE, BM_SETCHECK, (strOtherRights.Find(_T("w")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_EXECUTE, BM_SETCHECK, (strOtherRights.Find(_T("x")) == -1) ? UNCHECKED : CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_READ, BM_SETCHECK, (strOtherRights.Find(_T("r")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_WRITE, BM_SETCHECK, (strOtherRights.Find(_T("w")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_EXECUTE, BM_SETCHECK, (strOtherRights.Find(_T("x")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_UID, BM_SETCHECK, (strSuidRights.Find(_T("s")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_GID, BM_SETCHECK, (strSuidRights.Find(_T("g")) == -1) ? UNCHECKED : CHECKED, 0); - SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_VTX, BM_SETCHECK, (strSuidRights.Find(_T("v")) == -1) ? UNCHECKED : CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_UID, BM_SETCHECK, (strSuidRights.Find(_T("s")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_GID, BM_SETCHECK, (strSuidRights.Find(_T("g")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); + SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_VTX, BM_SETCHECK, (strSuidRights.Find(_T("v")) == -1) ? BST_UNCHECKED : BST_CHECKED, 0); } void CPropFile::EnableUnixMode(BOOL bEnable) @@ -250,31 +250,31 @@ void CPropFile::MakeUnixModeString(CString& userRights, CString& groupRights, CS otherRights.Empty(); suidRights.Empty(); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_READ, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_READ, BM_GETCHECK, 0,0) == BST_CHECKED) userRights += _T("r"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_WRITE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_WRITE, BM_GETCHECK, 0,0) == BST_CHECKED) userRights += _T("w"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_EXECUTE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_USER_EXECUTE, BM_GETCHECK, 0,0) == BST_CHECKED) userRights += _T("x"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_READ, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_READ, BM_GETCHECK, 0,0) == BST_CHECKED) groupRights += _T("r"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_WRITE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_WRITE, BM_GETCHECK, 0,0) == BST_CHECKED) groupRights += _T("w"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_EXECUTE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_GROUP_EXECUTE, BM_GETCHECK, 0,0) == BST_CHECKED) groupRights += _T("x"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_READ, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_READ, BM_GETCHECK, 0,0) == BST_CHECKED) otherRights += _T("r"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_WRITE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_WRITE, BM_GETCHECK, 0,0) == BST_CHECKED) otherRights += _T("w"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_EXECUTE, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_OTHER_EXECUTE, BM_GETCHECK, 0,0) == BST_CHECKED) otherRights += _T("x"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_UID, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_UID, BM_GETCHECK, 0,0) == BST_CHECKED) suidRights += _T("s"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_GID, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_GID, BM_GETCHECK, 0,0) == BST_CHECKED) suidRights += _T("g"); - if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_VTX, BM_GETCHECK, 0,0) == CHECKED) + if (SendDlgItemMessage(m_hwnd, IDC_ATTR_SUID_VTX, BM_GETCHECK, 0,0) == BST_CHECKED) suidRights += _T("v"); } diff --git a/src/WINNT/client_exp/gui2fs.cpp b/src/WINNT/client_exp/gui2fs.cpp index faba0ca..6ba5c53 100644 --- a/src/WINNT/client_exp/gui2fs.cpp +++ b/src/WINNT/client_exp/gui2fs.cpp @@ -2168,38 +2168,38 @@ SetUnixModeBits( const CStringArray& files, const CString& user, const CString& inData.options.size = sizeof(inData.options); inData.options.field_flags = 0; inData.options.literal = 0; /* always applying to target */ - blob.in_size = inData.options.size; /* no variable length data */ + blob.in_size = sizeof(inData); /* no variable length data */ blob.in = &inData; blob.out = NULL; blob.out_size = 0; inData.unixModeBits = 0; - if (user.Find(_T("r")) != -1) + if (user.Find(_T('r')) != -1) inData.unixModeBits |= S_IRUSR; - if (user.Find(_T("w")) != -1) + if (user.Find(_T('w')) != -1) inData.unixModeBits |= S_IWUSR; - if (user.Find(_T("x")) != -1) + if (user.Find(_T('x')) != -1) inData.unixModeBits |= S_IXUSR; - if (group.Find(_T("r")) != -1) + if (group.Find(_T('r')) != -1) inData.unixModeBits |= S_IRGRP; - if (group.Find(_T("w")) != -1) + if (group.Find(_T('w')) != -1) inData.unixModeBits |= S_IWGRP; - if (group.Find(_T("x")) != -1) + if (group.Find(_T('x')) != -1) inData.unixModeBits |= S_IXGRP; - if (other.Find(_T("r")) != -1) + if (other.Find(_T('r')) != -1) inData.unixModeBits |= S_IROTH; - if (other.Find(_T("w")) != -1) + if (other.Find(_T('w')) != -1) inData.unixModeBits |= S_IWOTH; - if (other.Find(_T("x")) != -1) + if (other.Find(_T('x')) != -1) inData.unixModeBits |= S_IXOTH; - if (suid.Find(_T("s")) != -1) + if (suid.Find(_T('s')) != -1) inData.unixModeBits |= S_ISUID; - if (suid.Find(_T("g")) != -1) + if (suid.Find(_T('g')) != -1) inData.unixModeBits |= S_ISGID; - if (suid.Find(_T("v")) != -1) + if (suid.Find(_T('v')) != -1) inData.unixModeBits |= S_ISVTX; for (int i = 0; i < files.GetSize(); i++) -- 1.9.4