File: PR-1241.patch

package info (click to toggle)
libssh2 1.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,504 kB
  • sloc: ansic: 46,104; sh: 6,164; makefile: 348; cpp: 120; perl: 65; lisp: 33; awk: 23
file content (44 lines) | stat: -rw-r--r-- 1,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Description: Backport PR 1241
Author: Nicolas Mora <babelouest@debian.org>
Forwarded: https://github.com/libssh2/libssh2/issues/1240
--- a/tests/session_fixture.c
+++ b/tests/session_fixture.c
@@ -431,10 +431,13 @@
     /* Ignore our hard-wired Dockerfile user when not running under Docker */
     if(!openssh_fixture_have_docker() && strcmp(username, "libssh2") == 0) {
         username = getenv("USER");
-#ifdef WIN32
-        if(!username)
+        if(!username) {
+#ifdef _WIN32
             username = getenv("USERNAME");
+#else
+            username = getenv("LOGNAME");
 #endif
+        }
     }
 
     userauth_list = libssh2_userauth_list(session, username,
--- a/tests/test_ssh2.c
+++ b/tests/test_ssh2.c
@@ -61,12 +61,16 @@
     (void)argc;
     (void)argv;
 
+    #ifdef _WIN32
+    #define LIBSSH2_FALLBACK_USER_ENV "USERNAME"
+    #else
+    #define LIBSSH2_FALLBACK_USER_ENV "LOGNAME"
+    #endif
+
     if(getenv("USER"))
         username = getenv("USER");
-#ifdef WIN32
-    else if(getenv("USERNAME"))
-        username = getenv("USERNAME");
-#endif
+    else if(getenv(LIBSSH2_FALLBACK_USER_ENV))
+        username = getenv(LIBSSH2_FALLBACK_USER_ENV);
 
     if(getenv("PRIVKEY"))
         privkey = getenv("PRIVKEY");