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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
Author: Martin Pitt <martin.pitt@ubuntu.com>
Description: When locking a root-owned screen, check that root has a
password set. If not, ask for an unlocking key.
See https://bugs.launchpad.net/bugs/6760
Index: screen/attacher.c
===================================================================
--- screen.orig/attacher.c 2014-04-17 14:18:51.212368190 +0200
+++ screen/attacher.c 2014-04-17 14:18:51.204368735 +0200
@@ -847,11 +847,15 @@
#ifdef USE_PAM
pam_handle_t *pamh = 0;
int pam_error;
-#else
- char *pass, mypass[16 + 1], salt[3];
#endif
+ char *pass, mypass[16 + 1], salt[3];
+ int using_pam = 1;
-#ifndef USE_PAM
+#ifdef USE_PAM
+ if (!ppp->pw_uid)
+ {
+#endif
+ using_pam = 0;
pass = ppp->pw_passwd;
if (pass == 0 || *pass == 0)
{
@@ -890,6 +894,8 @@
}
pass = ppp->pw_passwd = SaveStr(pass);
}
+#ifdef USE_PAM
+ }
#endif
debug("screen_builtin_lck looking in gcos field\n");
@@ -919,6 +925,8 @@
AttacherFinit(SIGARG);
/* NOTREACHED */
}
+ if (using_pam)
+ {
#ifdef USE_PAM
PAM_conversation.appdata_ptr = cp1;
pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh);
@@ -929,11 +937,14 @@
PAM_conversation.appdata_ptr = 0;
if (pam_error == PAM_SUCCESS)
break;
-#else
- char *buf = crypt(cp1, pass);
- if (buf && !strncmp(buf, pass, strlen(pass)))
- break;
#endif
+ }
+ else
+ {
+ char *buf = crypt(cp1, pass);
+ if (buf && !strncmp(buf, pass, strlen(pass)))
+ break;
+ }
debug("screen_builtin_lck: NO!!!!!\n");
bzero(cp1, strlen(cp1));
}
|