mirror of
https://github.com/tmate-io/tmate.git
synced 2025-03-10 13:08:30 +01:00
- Make it compile on operating systems other than BSD due to OpenBSD patchset
308. - While there, remove some duplicate code from the compat header file.
This commit is contained in:
parent
f796336a12
commit
c274551db6
61
compat.h
61
compat.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: compat.h,v 1.16 2009-09-02 12:30:56 nicm Exp $ */
|
/* $Id: compat.h,v 1.17 2009-09-03 20:54:39 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -91,6 +91,10 @@ typedef uint64_t u_int64_t;
|
|||||||
#include "compat/imsg.h"
|
#include "compat/imsg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LOGIN_CAP
|
||||||
|
#include <login_cap.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BROKEN_CMSG_FIRSTHDR
|
#ifdef HAVE_BROKEN_CMSG_FIRSTHDR
|
||||||
/* Broken on OS X. */
|
/* Broken on OS X. */
|
||||||
#undef CMSG_FIRSTHDR
|
#undef CMSG_FIRSTHDR
|
||||||
@ -146,6 +150,10 @@ typedef uint64_t u_int64_t;
|
|||||||
#define TTY_NAME_MAX 32
|
#define TTY_NAME_MAX 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PW_BUF_LEN
|
||||||
|
#define _PW_BUF_LEN 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_BZERO
|
#ifndef HAVE_BZERO
|
||||||
#define bzero(buf, len) memset((buf), 0, (len));
|
#define bzero(buf, len) memset((buf), 0, (len));
|
||||||
#endif
|
#endif
|
||||||
@ -211,54 +219,3 @@ int BSDgetopt(int, char *const *, const char *);
|
|||||||
#define optreset BSDoptreset
|
#define optreset BSDoptreset
|
||||||
#define optarg BSDoptarg
|
#define optarg BSDoptarg
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_STRTONUM
|
|
||||||
/* strtonum.c */
|
|
||||||
long long strtonum(const char *, long long, long long, const char **);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
|
||||||
/* strlcpy.c */
|
|
||||||
size_t strlcpy(char *, const char *, size_t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCAT
|
|
||||||
/* strlcat.c */
|
|
||||||
size_t strlcat(char *, const char *, size_t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_DAEMON
|
|
||||||
/* daemon.c */
|
|
||||||
int daemon(int, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_FORKPTY
|
|
||||||
/* forkpty.c */
|
|
||||||
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
|
||||||
/* asprintf.c */
|
|
||||||
int asprintf(char **, const char *, ...);
|
|
||||||
int vasprintf(char **, const char *, va_list);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_FGETLN
|
|
||||||
/* fgetln.c */
|
|
||||||
char *fgetln(FILE *, size_t *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_GETOPT
|
|
||||||
/* getopt.c */
|
|
||||||
extern int BSDopterr;
|
|
||||||
extern int BSDoptind;
|
|
||||||
extern int BSDoptopt;
|
|
||||||
extern int BSDoptreset;
|
|
||||||
extern char *BSDoptarg;
|
|
||||||
int BSDgetopt(int, char *const *, const char *);
|
|
||||||
#define getopt(ac, av, o) BSDgetopt(ac, av, o)
|
|
||||||
#define opterr BSDopterr
|
|
||||||
#define optind BSDoptind
|
|
||||||
#define optopt BSDoptopt
|
|
||||||
#define optreset BSDoptreset
|
|
||||||
#define optarg BSDoptarg
|
|
||||||
#endif
|
|
||||||
|
6
configure
vendored
6
configure
vendored
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $Id: configure,v 1.34 2009-09-02 12:30:56 nicm Exp $
|
# $Id: configure,v 1.35 2009-09-03 20:54:39 tcunha Exp $
|
||||||
|
|
||||||
TMUX_PLATFORM=${TMUX_PLATFORM:-`uname -s`}
|
TMUX_PLATFORM=${TMUX_PLATFORM:-`uname -s`}
|
||||||
|
|
||||||
@ -22,6 +22,7 @@ cat <<EOF >>$CONFIG_H
|
|||||||
#undef HAVE_GETOPT
|
#undef HAVE_GETOPT
|
||||||
#undef HAVE_IMSG
|
#undef HAVE_IMSG
|
||||||
#undef HAVE_LIBUTIL_H
|
#undef HAVE_LIBUTIL_H
|
||||||
|
#undef HAVE_LOGIN_CAP
|
||||||
#undef HAVE_PATHS_H
|
#undef HAVE_PATHS_H
|
||||||
#undef HAVE_POLL
|
#undef HAVE_POLL
|
||||||
#undef HAVE_PROGNAME
|
#undef HAVE_PROGNAME
|
||||||
@ -52,6 +53,7 @@ case $TMUX_PLATFORM in
|
|||||||
#define HAVE_FGETLN
|
#define HAVE_FGETLN
|
||||||
#define HAVE_FORKPTY
|
#define HAVE_FORKPTY
|
||||||
#define HAVE_GETOPT
|
#define HAVE_GETOPT
|
||||||
|
#define HAVE_LOGIN_CAP
|
||||||
#define HAVE_PATHS_H
|
#define HAVE_PATHS_H
|
||||||
#define HAVE_POLL
|
#define HAVE_POLL
|
||||||
#define HAVE_PROGNAME
|
#define HAVE_PROGNAME
|
||||||
@ -207,6 +209,7 @@ EOF
|
|||||||
#define HAVE_FORKPTY
|
#define HAVE_FORKPTY
|
||||||
#define HAVE_GETOPT
|
#define HAVE_GETOPT
|
||||||
#define HAVE_LIBUTIL_H
|
#define HAVE_LIBUTIL_H
|
||||||
|
#define HAVE_LOGIN_CAP
|
||||||
#define HAVE_PATHS_H
|
#define HAVE_PATHS_H
|
||||||
#define HAVE_POLL
|
#define HAVE_POLL
|
||||||
#define HAVE_PROGNAME
|
#define HAVE_PROGNAME
|
||||||
@ -238,6 +241,7 @@ EOF
|
|||||||
#define HAVE_FGETLN
|
#define HAVE_FGETLN
|
||||||
#define HAVE_FORKPTY
|
#define HAVE_FORKPTY
|
||||||
#define HAVE_GETOPT
|
#define HAVE_GETOPT
|
||||||
|
#define HAVE_LOGIN_CAP
|
||||||
#define HAVE_PATHS_H
|
#define HAVE_PATHS_H
|
||||||
#define HAVE_POLL
|
#define HAVE_POLL
|
||||||
#define HAVE_PROGNAME
|
#define HAVE_PROGNAME
|
||||||
|
10
server-fn.c
10
server-fn.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server-fn.c,v 1.84 2009-09-03 20:44:38 tcunha Exp $ */
|
/* $Id: server-fn.c,v 1.85 2009-09-03 20:54:39 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <login_cap.h>
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -199,7 +198,9 @@ int
|
|||||||
server_unlock(const char *s)
|
server_unlock(const char *s)
|
||||||
{
|
{
|
||||||
struct client *c;
|
struct client *c;
|
||||||
|
#ifdef HAVE_LOGIN_CAP
|
||||||
login_cap_t *lc;
|
login_cap_t *lc;
|
||||||
|
#endif
|
||||||
u_int i;
|
u_int i;
|
||||||
char *out;
|
char *out;
|
||||||
u_int failures, tries, backoff;
|
u_int failures, tries, backoff;
|
||||||
@ -250,6 +251,7 @@ wrong:
|
|||||||
* Start slowing down after "login-backoff" attempts and reset every
|
* Start slowing down after "login-backoff" attempts and reset every
|
||||||
* "login-tries" attempts.
|
* "login-tries" attempts.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_LOGIN_CAP
|
||||||
lc = login_getclass(server_locked_pw->pw_class);
|
lc = login_getclass(server_locked_pw->pw_class);
|
||||||
if (lc != NULL) {
|
if (lc != NULL) {
|
||||||
tries = login_getcapnum(lc, (char *) "login-tries", 10, 10);
|
tries = login_getcapnum(lc, (char *) "login-tries", 10, 10);
|
||||||
@ -258,6 +260,10 @@ wrong:
|
|||||||
tries = 10;
|
tries = 10;
|
||||||
backoff = 3;
|
backoff = 3;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
tries = 10;
|
||||||
|
backoff = 3;
|
||||||
|
#endif
|
||||||
failures = password_failures % tries;
|
failures = password_failures % tries;
|
||||||
if (failures > backoff) {
|
if (failures > backoff) {
|
||||||
password_backoff += ((failures - backoff) * tries / 2);
|
password_backoff += ((failures - backoff) * tries / 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user