Skip to content

Commit f4b56e2

Browse files
nomachine + additional changes applied to openssh 7.1p1 source base
1 parent 47c23e5 commit f4b56e2

File tree

322 files changed

+43992
-16102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+43992
-16102
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ LDFLAGS=-L. -Lopenbsd-compat/ -Lcontrib/win32/win32compat @LDFLAGS@
5959
EXEEXT=@EXEEXT@
6060
MANFMT=@MANFMT@
6161

62-
TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT)
62+
TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT)
6363

6464
LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \
6565
canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \

addrmatch.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: addrmatch.c,v 1.5 2010/02/26 20:29:54 djm Exp $ */
1+
/* $OpenBSD: addrmatch.c,v 1.10 2015/07/08 19:04:21 markus Exp $ */
22

33
/*
44
* Copyright (c) 2004-2008 Damien Miller <[email protected]>
@@ -31,7 +31,6 @@
3131

3232
#include "match.h"
3333
#include "log.h"
34-
#include "xmalloc.h"
3534

3635
struct xaddr {
3736
sa_family_t af;
@@ -88,13 +87,13 @@ addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa)
8887

8988
switch (sa->sa_family) {
9089
case AF_INET:
91-
if (slen < sizeof(*in4))
90+
if (slen < (socklen_t)sizeof(*in4))
9291
return -1;
9392
xa->af = AF_INET;
9493
memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4));
9594
break;
9695
case AF_INET6:
97-
if (slen < sizeof(*in6))
96+
if (slen < (socklen_t)sizeof(*in6))
9897
return -1;
9998
xa->af = AF_INET6;
10099
memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6));
@@ -318,7 +317,7 @@ addr_pton_cidr(const char *p, struct xaddr *n, u_int *l)
318317
char addrbuf[64], *mp, *cp;
319318

320319
/* Don't modify argument */
321-
if (p == NULL || strlcpy(addrbuf, p, sizeof(addrbuf)) > sizeof(addrbuf))
320+
if (p == NULL || strlcpy(addrbuf, p, sizeof(addrbuf)) >= sizeof(addrbuf))
322321
return -1;
323322

324323
if ((mp = strchr(addrbuf, '/')) != NULL) {
@@ -420,7 +419,7 @@ addr_match_list(const char *addr, const char *_list)
420419
goto foundit;
421420
}
422421
}
423-
xfree(o);
422+
free(o);
424423

425424
return ret;
426425
}
@@ -494,7 +493,7 @@ addr_match_cidr_list(const char *addr, const char *_list)
494493
continue;
495494
}
496495
}
497-
xfree(o);
496+
free(o);
498497

499498
return ret;
500499
}

atomicio.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: atomicio.c,v 1.26 2010/09/22 22:58:51 djm Exp $ */
1+
/* $OpenBSD: atomicio.c,v 1.27 2015/01/16 06:40:12 deraadt Exp $ */
22
/*
33
* Copyright (c) 2006 Damien Miller. All rights reserved.
44
* Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
@@ -41,6 +41,7 @@
4141
#endif
4242
#include <string.h>
4343
#include <unistd.h>
44+
#include <limits.h>
4445

4546
#include "atomicio.h"
4647

@@ -56,16 +57,20 @@ atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
5657
ssize_t res;
5758
struct pollfd pfd;
5859

60+
#ifndef BROKEN_READ_COMPARISON
5961
pfd.fd = fd;
6062
pfd.events = f == read ? POLLIN : POLLOUT;
63+
#endif
6164
while (n > pos) {
6265
res = (f) (fd, s + pos, n - pos);
6366
switch (res) {
6467
case -1:
6568
if (errno == EINTR)
6669
continue;
6770
if (errno == EAGAIN || errno == EWOULDBLOCK) {
71+
#ifndef BROKEN_READ_COMPARISON
6872
(void)poll(&pfd, 1, -1);
73+
#endif
6974
continue;
7075
}
7176
return 0;

audit-bsm.c

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: audit-bsm.c,v 1.7 2011/01/17 10:15:29 dtucker Exp $ */
1+
/* $Id: audit-bsm.c,v 1.8 2012/02/23 23:40:43 dtucker Exp $ */
22

33
/*
44
* TODO
@@ -55,6 +55,10 @@
5555
#include <string.h>
5656
#include <unistd.h>
5757

58+
#ifdef BROKEN_BSM_API
59+
#include <libscf.h>
60+
#endif
61+
5862
#include "ssh.h"
5963
#include "log.h"
6064
#include "key.h"
@@ -124,6 +128,12 @@ extern int aug_daemon_session(void);
124128
extern Authctxt *the_authctxt;
125129
static AuditInfoTermID ssh_bsm_tid;
126130

131+
#ifdef BROKEN_BSM_API
132+
/* For some reason this constant is no longer defined
133+
in Solaris 11. */
134+
#define BSM_TEXTBUFSZ 256
135+
#endif
136+
127137
/* Below is the low-level BSM interface code */
128138

129139
/*
@@ -171,6 +181,65 @@ aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type)
171181
}
172182
#endif
173183

184+
#ifdef BROKEN_BSM_API
185+
/*
186+
In Solaris 11 the audit daemon has been moved to SMF. In the process
187+
they simply dropped getacna() from the API, since it read from a now
188+
non-existent config file. This function re-implements getacna() to
189+
read from the SMF repository instead.
190+
*/
191+
int
192+
getacna(char *auditstring, int len)
193+
{
194+
scf_handle_t *handle = NULL;
195+
scf_property_t *property = NULL;
196+
scf_value_t *value = NULL;
197+
int ret = 0;
198+
199+
handle = scf_handle_create(SCF_VERSION);
200+
if (handle == NULL)
201+
return -2; /* The man page for getacna on Solaris 10 states
202+
we should return -2 in case of error and set
203+
errno to indicate the error. We don't bother
204+
with errno here, though, since the only use
205+
of this function below doesn't check for errors
206+
anyway.
207+
*/
208+
209+
ret = scf_handle_bind(handle);
210+
if (ret == -1)
211+
return -2;
212+
213+
property = scf_property_create(handle);
214+
if (property == NULL)
215+
return -2;
216+
217+
ret = scf_handle_decode_fmri(handle,
218+
"svc:/system/auditd:default/:properties/preselection/naflags",
219+
NULL, NULL, NULL, NULL, property, 0);
220+
if (ret == -1)
221+
return -2;
222+
223+
value = scf_value_create(handle);
224+
if (value == NULL)
225+
return -2;
226+
227+
ret = scf_property_get_value(property, value);
228+
if (ret == -1)
229+
return -2;
230+
231+
ret = scf_value_get_astring(value, auditstring, len);
232+
if (ret == -1)
233+
return -2;
234+
235+
scf_value_destroy(value);
236+
scf_property_destroy(property);
237+
scf_handle_destroy(handle);
238+
239+
return 0;
240+
}
241+
#endif
242+
174243
/*
175244
* Check if the specified event is selected (enabled) for auditing.
176245
* Returns 1 if the event is selected, 0 if not and -1 on failure.
@@ -223,7 +292,15 @@ bsm_audit_record(int typ, char *string, au_event_t event_no)
223292
(void) au_write(ad, au_to_text(string));
224293
(void) au_write(ad, AUToReturnFunc(typ, rc));
225294

295+
#ifdef BROKEN_BSM_API
296+
/* The last argument is the event modifier flags. For
297+
some seemingly undocumented reason it was added in
298+
Solaris 11. */
299+
rc = au_close(ad, AU_TO_WRITE, event_no, 0);
300+
#else
226301
rc = au_close(ad, AU_TO_WRITE, event_no);
302+
#endif
303+
227304
if (rc < 0)
228305
error("BSM audit: %s failed to write \"%s\" record: %s",
229306
__func__, string, strerror(errno));

auth-bsdauth.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: auth-bsdauth.c,v 1.11 2007/09/21 08:15:29 djm Exp $ */
1+
/* $OpenBSD: auth-bsdauth.c,v 1.13 2014/06/24 01:13:21 djm Exp $ */
22
/*
33
* Copyright (c) 2001 Markus Friedl. All rights reserved.
44
*
@@ -24,7 +24,6 @@
2424
*/
2525

2626
#include "includes.h"
27-
2827
/*
2928
* We support only client side kerberos on Windows.
3029
*/
@@ -35,6 +34,8 @@
3534
#endif
3635

3736
#include <sys/types.h>
37+
#include <stdarg.h>
38+
#include <stdio.h>
3839

3940
#include <stdarg.h>
4041

@@ -63,6 +64,11 @@ bsdauth_query(void *ctx, char **name, char **infotxt,
6364
Authctxt *authctxt = ctx;
6465
char *challenge = NULL;
6566

67+
*infotxt = NULL;
68+
*numprompts = 0;
69+
*prompts = NULL;
70+
*echo_on = NULL;
71+
6672
if (authctxt->as != NULL) {
6773
debug2("bsdauth_query: try reuse session");
6874
challenge = auth_getitem(authctxt->as, AUTHV_CHALLENGE);

auth-chall.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: auth-chall.c,v 1.12 2006/08/03 03:34:41 deraadt Exp $ */
1+
/* $OpenBSD: auth-chall.c,v 1.14 2014/06/24 01:13:21 djm Exp $ */
22
/*
33
* Copyright (c) 2001 Markus Friedl. All rights reserved.
44
*
@@ -26,14 +26,16 @@
2626
#include "includes.h"
2727

2828
#include <sys/types.h>
29-
3029
#include <stdarg.h>
30+
#include <stdlib.h>
31+
#include <stdio.h>
3132

3233
#include "xmalloc.h"
3334
#include "key.h"
3435
#include "hostfile.h"
3536
#include "auth.h"
3637
#include "log.h"
38+
#include "misc.h"
3739
#include "servconf.h"
3840

3941
/* limited protocol v1 interface to kbd-interactive authentication */
@@ -69,11 +71,11 @@ get_challenge(Authctxt *authctxt)
6971
fatal("get_challenge: numprompts < 1");
7072
challenge = xstrdup(prompts[0]);
7173
for (i = 0; i < numprompts; i++)
72-
xfree(prompts[i]);
73-
xfree(prompts);
74-
xfree(name);
75-
xfree(echo_on);
76-
xfree(info);
74+
free(prompts[i]);
75+
free(prompts);
76+
free(name);
77+
free(echo_on);
78+
free(info);
7779

7880
return (challenge);
7981
}
@@ -102,11 +104,11 @@ verify_response(Authctxt *authctxt, const char *response)
102104
authenticated = 1;
103105

104106
for (i = 0; i < numprompts; i++)
105-
xfree(prompts[i]);
106-
xfree(prompts);
107-
xfree(name);
108-
xfree(echo_on);
109-
xfree(info);
107+
free(prompts[i]);
108+
free(prompts);
109+
free(name);
110+
free(echo_on);
111+
free(info);
110112
break;
111113
}
112114
device->free_ctx(authctxt->kbdintctxt);

0 commit comments

Comments
 (0)