20
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
22
* GNU General Public License for more details.
24
24
* You should have received a copy of the GNU General Public License
25
25
* along with this program; if not, write to the Free Software
26
26
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
64
64
DWORD dwTotalCount = 0;
66
/* Convert ANSI User Name and Group to Unicode */
66
/* Convert ANSI User Name and Group to Unicode */
68
68
MultiByteToWideChar(CP_ACP, 0, UserName,
69
strlen(UserName) + 1, wszUserName,
70
sizeof(wszUserName) / sizeof(wszUserName[0]));
69
strlen(UserName) + 1, wszUserName,
70
sizeof(wszUserName) / sizeof(wszUserName[0]));
71
71
MultiByteToWideChar(CP_ACP, 0, Group,
72
strlen(Group) + 1, wszGroup, sizeof(wszGroup) / sizeof(wszGroup[0]));
72
strlen(Group) + 1, wszGroup, sizeof(wszGroup) / sizeof(wszGroup[0]));
75
* Call the NetUserGetLocalGroups function
76
* specifying information level 0.
78
* The LG_INCLUDE_INDIRECT flag specifies that the
79
* function should also return the names of the local
80
* groups in which the user is indirectly a member.
82
nStatus = NetUserGetLocalGroups(NULL,
86
(LPBYTE *) & pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries);
88
* If the call succeeds,
75
* Call the NetUserGetLocalGroups function
76
* specifying information level 0.
78
* The LG_INCLUDE_INDIRECT flag specifies that the
79
* function should also return the names of the local
80
* groups in which the user is indirectly a member.
82
nStatus = NetUserGetLocalGroups(NULL,
86
(LPBYTE *) & pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries);
88
* If the call succeeds,
90
90
if (nStatus == NERR_Success) {
91
if ((pTmpBuf = pBuf) != NULL) {
92
for (i = 0; i < dwEntriesRead; i++) {
93
if (pTmpBuf == NULL) {
97
if (wcscmp(pTmpBuf->lgrui0_name, wszGroup) == 0) {
91
if ((pTmpBuf = pBuf) != NULL) {
92
for (i = 0; i < dwEntriesRead; i++) {
93
if (pTmpBuf == NULL) {
97
if (wcscmp(pTmpBuf->lgrui0_name, wszGroup) == 0) {
108
* Free the allocated memory.
108
* Free the allocated memory.
110
110
if (pBuf != NULL)
111
NetApiBufferFree(pBuf);
111
NetApiBufferFree(pBuf);
139
139
if (domain_qualify == NULL) {
140
strcpy(User, NTDomain);
141
strcpy(NTDomain, Default_NTDomain);
140
strcpy(User, NTDomain);
141
strcpy(NTDomain, Default_NTDomain);
143
strcpy(User, domain_qualify + 1);
144
domain_qualify[0] = '\0';
143
strcpy(User, domain_qualify + 1);
144
domain_qualify[0] = '\0';
146
146
/* Log the client on to the local computer. */
147
147
if (!SSP_LogonUser(User, Password, NTDomain)) {
148
result = NTV_LOGON_ERROR;
148
result = NTV_LOGON_ERROR;
149
149
errormsg = NTV_LOGON_ERROR_MSG;
150
150
debug("%s\n", errormsg);
152
result = NTV_NO_ERROR;
153
if (strcmp(NTDomain, NTV_DEFAULT_DOMAIN) == 0)
154
strcpy(DomainUser, User);
156
strcpy(DomainUser, NTDomain);
157
strcat(DomainUser, "\\");
158
strcat(DomainUser, User);
160
if (UseAllowedGroup) {
161
if (!Valid_Group(DomainUser, NTAllowedGroup)) {
162
result = NTV_GROUP_ERROR;
163
errormsg = NTV_GROUP_ERROR_MSG;
164
debug("%s\n", errormsg);
167
if (UseDisallowedGroup) {
168
if (Valid_Group(DomainUser, NTDisAllowedGroup)) {
169
result = NTV_GROUP_ERROR;
170
errormsg = NTV_GROUP_ERROR_MSG;
171
debug("%s\n", errormsg);
152
result = NTV_NO_ERROR;
153
if (strcmp(NTDomain, NTV_DEFAULT_DOMAIN) == 0)
154
strcpy(DomainUser, User);
156
strcpy(DomainUser, NTDomain);
157
strcat(DomainUser, "\\");
158
strcat(DomainUser, User);
160
if (UseAllowedGroup) {
161
if (!Valid_Group(DomainUser, NTAllowedGroup)) {
162
result = NTV_GROUP_ERROR;
163
errormsg = NTV_GROUP_ERROR_MSG;
164
debug("%s\n", errormsg);
167
if (UseDisallowedGroup) {
168
if (Valid_Group(DomainUser, NTDisAllowedGroup)) {
169
result = NTV_GROUP_ERROR;
170
errormsg = NTV_GROUP_ERROR_MSG;
171
debug("%s\n", errormsg);