Project

General

Profile

0001-Allow-headless-installation-using-remote-frontend.patch

ddegroot, 10/08/2018 03:19 AM

View differences:

usr.sbin/installer/dfuibe_installer/Makefile
9 9

  
10 10
CFLAGS+=-I${.CURDIR}/..
11 11

  
12
.if exists(${.OBJDIR}/../libaura)
12
.if exists(${.OBJDIR}/libaura)
13
LIBAURA=${.OBJDIR}/libaura/libaura.a
14
.elif exists(${.OBJDIR}/../libaura)
13 15
LIBAURA=${.OBJDIR}/../libaura/libaura.a
14 16
.else
15 17
LIBAURA=${.CURDIR}/../libaura/libaura.a
16 18
.endif
17 19

  
18
.if exists(${.OBJDIR}/../libdfui)
20
.if exists(${.OBJDIR}/libdfui)
21
LIBDFUI=${.OBJDIR}/libdfui/libdfui.a
22
.elif exists(${.OBJDIR}/../libdfui)
19 23
LIBDFUI=${.OBJDIR}/../libdfui/libdfui.a
20 24
.else
21 25
LIBDFUI=${.CURDIR}/../libdfui/libdfui.a
22 26
.endif
23 27

  
24
.if exists(${.OBJDIR}/../libinstaller)
28
.if exists(${.OBJDIR}/libinstaller)
29
LIBINSTALLER=${.OBJDIR}/libinstaller/libinstaller.a
30
.elif exists(${.OBJDIR}/../libinstaller)
25 31
LIBINSTALLER=${.OBJDIR}/../libinstaller/libinstaller.a
26 32
.else
27 33
LIBINSTALLER=${.CURDIR}/../libinstaller/libinstaller.a
usr.sbin/installer/dfuife_curses/Makefile
8 8

  
9 9
CFLAGS+=-I${.CURDIR}/..
10 10

  
11
.if exists(${.OBJDIR}/../libaura)
11
.if exists(${.OBJDIR}/libaura)
12
LIBAURA=${.OBJDIR}/libaura/libaura.a
13
.elif exists(${.OBJDIR}/../libaura)
12 14
LIBAURA=${.OBJDIR}/../libaura/libaura.a
13 15
.else
14 16
LIBAURA=${.CURDIR}/../libaura/libaura.a
15 17
.endif
16 18

  
17
.if exists(${.OBJDIR}/../libdfui)
19
.if exists(${.OBJDIR}/libdfui)
20
LIBDFUI=${.OBJDIR}/libdfui/libdfui.a
21
.elif exists(${.OBJDIR}/../libdfui)
18 22
LIBDFUI=${.OBJDIR}/../libdfui/libdfui.a
19 23
.else
20 24
LIBDFUI=${.CURDIR}/../libdfui/libdfui.a
21 25
.endif
22 26

  
23
.if exists(${.OBJDIR}/../libinstaller)
27
.if exists(${.OBJDIR}/libinstaller)
28
LIBINSTALLER=${.OBJDIR}/libinstaller/libinstaller.a
29
.elif exists(${.OBJDIR}/../libinstaller)
24 30
LIBINSTALLER=${.OBJDIR}/../libinstaller/libinstaller.a
25 31
.else
26 32
LIBINSTALLER=${.CURDIR}/../libinstaller/libinstaller.a
usr.sbin/installer/libdfui/conn_tcp.c
90 90
dfui_tcp_be_start(struct dfui_connection *c)
91 91
{
92 92
	struct sockaddr_in servaddr;
93
	char server_ip[16] = "127.0.0.1";
93 94
	int server_port;
94 95
	int tru = 1;
95 96

  
96
	server_port = atoi(c->rendezvous);
97
	if (sscanf(c->rendezvous, "%[^:]:%u", server_ip, &server_port) != 2) {
98
		strncpy(server_ip, "127.0.0.1", 16 * sizeof(char));
99
		server_port = atoi(c->rendezvous);
100
	}
97 101

  
98 102
	/*
99 103
	 * Create the tcp socket
......
111 115
	bzero(&servaddr, sizeof(servaddr));
112 116
	servaddr.sin_family = AF_INET;
113 117
	servaddr.sin_port = htons(server_port);
114
	switch(inet_pton(AF_INET, "127.0.0.1", &servaddr.sin_addr)) {
118
	switch(inet_pton(AF_INET, server_ip, &servaddr.sin_addr)) {
115 119
	case 0:
116 120
		warnx("inet_pton(): address not parseable");
117 121
		return(DFUI_FAILURE);
......
126 130
		warn("bind()");
127 131
		return(DFUI_FAILURE);
128 132
	}
129
	dfui_debug("BOUND_ON<<%d>>\n", T_TCP(c)->listen_sd);
133
	dfui_debug("BOUND_ON<<%d>> %s:%d\n", T_TCP(c)->listen_sd, server_ip, server_port);
130 134
	if (listen(T_TCP(c)->listen_sd, 0) == -1)
131 135
		return(DFUI_FAILURE);
132 136
	dfui_debug("LISTENING_ON<<%d>>\n", T_TCP(c)->listen_sd);
......
321 325
dfui_tcp_fe_connect(struct dfui_connection *c)
322 326
{
323 327
        struct sockaddr_in servaddr;
328
	char server_ip[16] = "127.0.0.1";
324 329
        int server_port;
325 330
	int connected = 0;
326 331

  
327
        server_port = atoi(c->rendezvous);
332
	if (sscanf(c->rendezvous, "%[^:]:%u", server_ip, &server_port) != 2) {
333
		strncpy(server_ip, "127.0.0.1", 16 * sizeof(char));
334
		server_port = atoi(c->rendezvous);
335
	}
328 336

  
329 337
        /*
330 338
         * Create the tcp socket
......
339 347
		bzero(&servaddr, sizeof(servaddr));
340 348
		servaddr.sin_family = AF_INET;
341 349
		servaddr.sin_port = htons(server_port);
342
		inet_pton(AF_INET, "127.0.0.1", &servaddr.sin_addr);
350
		inet_pton(AF_INET, server_ip, &servaddr.sin_addr);
343 351

  
344 352
		if (connect(T_TCP(c)->connected_sd, (struct sockaddr *)&servaddr,
345 353
		    sizeof(servaddr)) == 0) {
346
-