libnetconf2 CHANGE QNX compatibility (#220)
fixes #217
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 412fbac..215d2c6 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -14,21 +14,25 @@
#define _GNU_SOURCE
+#include "config.h" /* Expose HAVE_SHADOW and HAVE_CRYPT */
+
+#ifdef HAVE_SHADOW
+ #include <shadow.h>
+#endif
+#ifdef HAVE_CRYPT
+ #include <crypt.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
-#ifndef __APPLE__
-#include <shadow.h>
-#include <crypt.h>
-#endif
#include <errno.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
-#include "config.h"
#include "session_server.h"
#include "session_server_ch.h"
#include "libnetconf.h"
@@ -664,7 +668,7 @@
static char *
auth_password_get_pwd_hash(const char *username)
{
-#ifndef __APPLE__
+#ifdef HAVE_SHADOW
struct passwd *pwd, pwd_buf;
struct spwd *spwd, spwd_buf;
char *pass_hash = NULL, buf[256];
@@ -676,7 +680,11 @@
}
if (!strcmp(pwd->pw_passwd, "x")) {
- getspnam_r(username, &spwd_buf, buf, 256, &spwd);
+ #ifndef __QNXNTO__
+ getspnam_r(username, &spwd_buf, buf, 256, &spwd);
+ #else
+ spwd = getspnam_r(username, &spwd_buf, buf, 256);
+ #endif
if (!spwd) {
VRB("Failed to retrieve the shadow entry for \"%s\".", username);
return NULL;