*
* Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002-2013 Wayne Davison
+ * Copyright (C) 2002-2018 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
if (am_server) { /* daemon over --rsh mode */
char *env_str;
strlcpy(addr_buf, "0.0.0.0", sizeof addr_buf);
- if ((env_str = getenv("SSH_CONNECTION")) != NULL
+ if ((env_str = getenv("REMOTE_HOST")) != NULL
+ || (env_str = getenv("SSH_CONNECTION")) != NULL
|| (env_str = getenv("SSH_CLIENT")) != NULL
- || (env_str = getenv("SSH2_CLIENT")) != NULL
- || (env_str = getenv("REMOTE_HOST")) != NULL) {
+ || (env_str = getenv("SSH2_CLIENT")) != NULL) {
char *p;
strlcpy(addr_buf, env_str, sizeof addr_buf);
/* Truncate the value to just the IP address. */