Browse code

likewise-open: Fix incorrect type declaration

When we moved to gcc 7.3 sometime ago, it had flagged the following
warning:

../lsass/server/auth-providers/ad-open-provider/join/join.c:735:9: note: did you mean to dereference the pointer?
if (pwszMachinePassword[0] == '\0')
^

Though we "fixed" this issue by dereferencing the pointer back then,
it turns out that the underlying problem is that 'pwszMachinePassword'
has been declared as the wrong data type. It should have been an array
of WCHAR, rather than an array of PWSTR pointers. So fix it correctly.
(Thanks to Adam Bernstein for pointing this out.)

Also, while at it, remove the obsolete gcc-6.3 patch.

Change-Id: Idca2d2790ae51535d018c7e548972da299e9afc1
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5759
Tested-by: michellew <michellew@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Reviewed-by: Srivatsa S. Bhat <srivatsab@vmware.com>

Srivatsa S. Bhat authored on 2018/09/21 08:12:36
Showing 2 changed files
... ...
@@ -39,12 +39,12 @@ cc1: all warnings being treated as errors
39 39
 
40 40
 Signed-off-by: Srivatsa S. Bhat <srivatsa@csail.mit.edu>
41 41
 ---
42
- dcerpc/ncklib/cnxfer.c                                   | 2 +-
43
- lsass/server/auth-providers/ad-open-provider/join/join.c | 2 +-
44
- lwreg/server/providers/sqlite/sqliteapi.c                | 2 +-
45
- lwreg/shell/export.c                                     | 2 +-
46
- lwreg/utils/fileutils.c                                  | 2 +-
47
- 5 files changed, 5 insertions(+), 5 deletions(-)
42
+ dcerpc/ncklib/cnxfer.c                                   |  2 +-
43
+ lsass/server/auth-providers/ad-open-provider/join/join.c | 12 ++++++------
44
+ lwreg/server/providers/sqlite/sqliteapi.c                |  2 +-
45
+ lwreg/shell/export.c                                     |  2 +-
46
+ lwreg/utils/fileutils.c                                  |  2 +-
47
+ 5 files changed, 10 insertions(+), 10 deletions(-)
48 48
 
49 49
 diff --git a/dcerpc/ncklib/cnxfer.c b/dcerpc/ncklib/cnxfer.c
50 50
 index cb8a6fd..dda5670 100644
... ...
@@ -60,18 +60,51 @@ index cb8a6fd..dda5670 100644
60 60
              /*
61 61
               * rpc__cn_dealloc_buffered_data will always skip the
62 62
 diff --git a/lsass/server/auth-providers/ad-open-provider/join/join.c b/lsass/server/auth-providers/ad-open-provider/join/join.c
63
-index 971ddf3..cfaab80 100644
63
+index 971ddf3..048a3dd 100644
64 64
 --- a/lsass/server/auth-providers/ad-open-provider/join/join.c
65 65
 +++ b/lsass/server/auth-providers/ad-open-provider/join/join.c
66
-@@ -732,7 +732,7 @@ LsaJoinDomainInternal(
67
-                sizeof(pwszMachinePassword)/sizeof(pwszMachinePassword[0]));
66
+@@ -627,7 +627,7 @@ LsaJoinDomainInternal(
67
+     LsaPolicyInformation *pLsaPolicyInfo = NULL;
68
+     PWSTR pwszMachineName = NULL;
69
+     PWSTR pwszMachineAcctName = NULL;
70
+-    PWSTR pwszMachinePassword[MACHPASS_LEN+1] = {0};
71
++    WCHAR wszMachinePassword[MACHPASS_LEN+1] = {0};
72
+     PWSTR pwszDomainName = NULL;
73
+     PSID pDomainSid = NULL;
74
+     PWSTR pwszDnsDomainName = NULL;
75
+@@ -728,11 +728,11 @@ LsaJoinDomainInternal(
76
+     }
77
+ 
78
+     dwError = LsaGenerateMachinePassword(
79
+-               (PWSTR)pwszMachinePassword,
80
+-               sizeof(pwszMachinePassword)/sizeof(pwszMachinePassword[0]));
81
++               wszMachinePassword,
82
++               sizeof(wszMachinePassword)/sizeof(wszMachinePassword[0]));
68 83
      BAIL_ON_LSA_ERROR(dwError);
69 84
  
70 85
 -    if (pwszMachinePassword[0] == '\0')
71
-+    if (pwszMachinePassword[0] == NULL || *pwszMachinePassword[0] == '\0')
86
++    if (wszMachinePassword[0] == '\0')
72 87
      {
73 88
          BAIL_ON_NT_STATUS(STATUS_INTERNAL_ERROR);
74 89
      }
90
+@@ -740,7 +740,7 @@ LsaJoinDomainInternal(
91
+     ntStatus = LsaCreateMachineAccount(pwszDCName,
92
+                                        pCreds,
93
+                                        pwszMachineAcctName,
94
+-                                       (PWSTR)pwszMachinePassword,
95
++                                       wszMachinePassword,
96
+                                        dwJoinFlags,
97
+                                        &pwszDomainName,
98
+                                        &pDomainSid);
99
+@@ -774,7 +774,7 @@ LsaJoinDomainInternal(
100
+               pwszDnsDomainName,
101
+               pwszDCName,
102
+               pwszSidStr,
103
+-              (PWSTR)pwszMachinePassword);
104
++              wszMachinePassword);
105
+     BAIL_ON_LSA_ERROR(dwError);
106
+ 
107
+     /*
75 108
 diff --git a/lwreg/server/providers/sqlite/sqliteapi.c b/lwreg/server/providers/sqlite/sqliteapi.c
76 109
 index 4e50fa1..1008a66 100644
77 110
 --- a/lwreg/server/providers/sqlite/sqliteapi.c
78 111
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-From 0cb9c142b21ff86b6d1bb9fc1151d54fc20d1412 Mon Sep 17 00:00:00 2001
2
-From: Priyesh <ppadmavilasom@users.noreply.github.com>
3
-Date: Thu, 30 Mar 2017 11:35:06 -0700
4
-Subject: [PATCH] Update security.c
5
-
6
-Noticed when this issue was triggered in gcc-6.3
7
-../lwmsg/src/security.c:108:28: error: self-comparison always evaluates to false [-Werror=tautological-compare]
8
- else if (token->tclass != token->tclass)
9
- lwmsg/src/security.c | 2 +-
10
- 1 file changed, 1 insertion(+), 1 deletion(-)
11
-
12
-diff --git a/lwmsg/src/security.c b/lwmsg/src/security.c
13
-index 6fc8cd3..a78ff72 100644
14
-+++ b/lwmsg/src/security.c
15
-@@ -105,7 +105,7 @@ lwmsg_security_token_equal(
16
-     {
17
-         return LWMSG_TRUE;
18
-     }
19
--    else if (token->tclass != token->tclass)
20
-+    else if (token->tclass != other->tclass)
21
-     {
22
-         return LWMSG_FALSE;
23
-     }