Skip to content

Commit d8f4e79

Browse files
committed
Revert "Fix to domain logon and minor reformats to scp."
This reverts commit d4ff073.
1 parent d4ff073 commit d8f4e79

File tree

3 files changed

+16
-31
lines changed

3 files changed

+16
-31
lines changed
0 Bytes
Binary file not shown.

contrib/win32/win32compat/pwd.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <stdio.h>
3434
#include <LM.h>
3535
#include <sddl.h>
36-
#include <DsGetDC.h>
3736
#define SECURITY_WIN32
3837
#include <security.h>
3938
#include "inc\pwd.h"
@@ -71,7 +70,6 @@ get_passwd(const char *user_utf8, LPWSTR user_sid) {
7170
wchar_t reg_path[MAX_PATH], profile_home[MAX_PATH];
7271
HKEY reg_key = 0;
7372
int tmp_len = MAX_PATH;
74-
PDOMAIN_CONTROLLER_INFOW pdc = NULL;
7573

7674
errno = 0;
7775

@@ -100,26 +98,12 @@ get_passwd(const char *user_utf8, LPWSTR user_sid) {
10098
}
10199

102100
if (user_sid == NULL) {
103-
if (NetUserGetInfo(udom_utf16, uname_utf16, 23, &user_info) != NERR_Success) {
104-
if (DsGetDcNameW(NULL, udom_utf16, NULL, NULL, DS_DIRECTORY_SERVICE_PREFERRED, &pdc) == ERROR_SUCCESS) {
105-
if (NetUserGetInfo(pdc->DomainControllerName, uname_utf16, 23, &user_info) != NERR_Success ||
101+
if (NetUserGetInfo(udom_utf16, uname_utf16, 23, &user_info) != NERR_Success ||
106102
ConvertSidToStringSidW(((LPUSER_INFO_23)user_info)->usri23_user_sid, &user_sid_local) == FALSE) {
107103
errno = ENOMEM; //??
108104
goto done;
109-
}
110105
}
111-
else {
112-
errno = ENOMEM; //??
113-
goto done;
114-
}
115-
}
116-
else {
117-
if (ConvertSidToStringSidW(((LPUSER_INFO_23)user_info)->usri23_user_sid, &user_sid_local) == FALSE) {
118-
errno = ENOMEM; //??
119-
goto done;
120-
}
121-
}
122-
user_sid = user_sid_local;
106+
user_sid = user_sid_local;
123107
}
124108

125109
if (swprintf(reg_path, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\%ls", user_sid) == MAX_PATH ||
@@ -151,8 +135,6 @@ get_passwd(const char *user_utf8, LPWSTR user_sid) {
151135
LocalFree(user_sid_local);
152136
if (reg_key)
153137
RegCloseKey(reg_key);
154-
if (pdc)
155-
NetApiBufferFree(pdc);
156138
return ret;
157139
}
158140

scp.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,42 +1135,45 @@ main(int argc, char **argv)
11351135
throughlocal = 1;
11361136
break;
11371137
case 'o':
1138-
addargs(&remote_remote_args, "-%c", ch);
1139-
addargs(&remote_remote_args, "%s", optarg);
1140-
addargs(&args, "-%c", ch);
1141-
addargs(&args, "%s", optarg);
1142-
break;
1143-
case 'c':
1138+
case 'c':
11441139
addargs(&remote_remote_args, "-%c", ch);
11451140
addargs(&remote_remote_args, "%s", optarg);
11461141
addargs(&args, "-%c", ch);
11471142
addargs(&args, "%s", optarg);
11481143

1149-
cipher = xstrdup(optarg);;
1144+
cipher = malloc(strlen(optarg) + 1);
1145+
if (cipher)
1146+
strcpy(cipher, optarg);
11501147
break;
11511148
case 'i':
11521149
addargs(&remote_remote_args, "-%c", ch);
11531150
addargs(&remote_remote_args, "%s", optarg);
11541151
addargs(&args, "-%c", ch);
11551152
addargs(&args, "%s", optarg);
11561153

1157-
identity = xstrdup(optarg);;
1154+
identity = malloc(strlen(optarg) + 1);
1155+
if (identity)
1156+
strcpy(identity, optarg);
11581157
break;
11591158
case 'F':
11601159
addargs(&remote_remote_args, "-%c", ch);
11611160
addargs(&remote_remote_args, "%s", optarg);
11621161
addargs(&args, "-%c", ch);
11631162
addargs(&args, "%s", optarg);
11641163

1165-
ssh_config = xstrdup(optarg);;
1164+
ssh_config = malloc(strlen(optarg) + 1);
1165+
if (ssh_config)
1166+
strcpy(ssh_config, optarg);
11661167
break;
11671168
case 'P':
11681169
addargs(&remote_remote_args, "-p");
11691170
addargs(&remote_remote_args, "%s", optarg);
11701171
addargs(&args, "-p");
11711172
addargs(&args, "%s", optarg);
11721173

1173-
port = xstrdup(optarg);;
1174+
port = malloc(strlen(optarg) + 1);
1175+
if (port)
1176+
strcpy(port, optarg);
11741177
break;
11751178
case 'B':
11761179
addargs(&remote_remote_args, "\"-oBatchmode yes\"");
@@ -1358,7 +1361,7 @@ toremote(char *targ, int argc, char **argv)
13581361
return;
13591362
}
13601363

1361-
for (i = 0; i < argc - 1; i++) {
1364+
for (i = 0; i < argc - 1; i++) {
13621365
src = colon(argv[i]);
13631366
if (src && throughlocal) { /* extended remote to remote */
13641367
*src++ = 0;

0 commit comments

Comments
 (0)