Skip to content

Commit f163e0c

Browse files
committed
5-10 C3
1 parent b6aca59 commit f163e0c

File tree

1 file changed

+9
-2
lines changed
  • contrib/win32/win32compat/ssh-agent

1 file changed

+9
-2
lines changed

contrib/win32/win32compat/ssh-agent/agent.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*/
3131
#include "agent.h"
32+
#include <sddl.h>
3233
#define BUFSIZE 5 * 1024
3334

3435
static HANDLE ioc_port = NULL;
@@ -40,7 +41,8 @@ static BOOL debug_mode = FALSE;
4041
#define AUTH_AGENT_PIPE_ID L"\\\\.\\pipe\\ssh-authagent"
4142

4243
static wchar_t *pipe_ids[NUM_LISTENERS] = { KEY_AGENT_PIPE_ID, PUBKEY_AGENT_PIPE_ID, AUTH_AGENT_PIPE_ID };
43-
static enum agent_type types[NUM_LISTENERS] = { KEY_AGENT, PUBKEY_AGENT, PUBKEY_AUTH_AGENT};
44+
static enum agent_type pipe_types[NUM_LISTENERS] = { KEY_AGENT, PUBKEY_AGENT, PUBKEY_AUTH_AGENT};
45+
static wchar_t *pipe_sddls[NUM_LISTENERS] = { L"D:P(A;; GA;;; AU)", L"D:P(A;; GA;;; AU)", L"D:P(A;; GA;;; AU)" };
4446
HANDLE event_stop_agent;
4547

4648
struct listener {
@@ -61,9 +63,14 @@ init_listeners() {
6163
return GetLastError();
6264
}
6365
listeners[i].pipe_id = pipe_ids[i];
64-
listeners[i].type = types[i];
66+
listeners[i].type = pipe_types[i];
6567
listeners[i].pipe = INVALID_HANDLE_VALUE;
6668
listeners[i].sa.bInheritHandle = TRUE;
69+
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(pipe_sddls[i], SDDL_REVISION_1,
70+
&listeners[i].sa.lpSecurityDescriptor, &listeners[i].sa.nLength)) {
71+
debug("cannot convert sddl ERROR:%d", GetLastError());
72+
return GetLastError();
73+
}
6774
}
6875

6976
return 0;

0 commit comments

Comments
 (0)