~ubuntu-branches/ubuntu/trusty/screen/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/10norootpassword.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-06-12 19:33:30 UTC
  • mfrom: (1.1.13 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080612193330-1tt3qhpxonbgdmq2
Tags: 4.0.3-11
* Unbreak <End> and <^A Bksp> using a patch from Loïc Minier
  (thanks!) - introduced as new 45suppress_remap.dpatch.
  Closes: #484647.
* Bump Standards version to 3.8.0. No changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 10norootpassword.dpatch by Martin Pitt <martin.pitt@ubuntu.com>
 
3
##
 
4
## DP: When locking a root-owned screen, check that root has a
 
5
## DP: password set. If not, ask for an unlocking key.
 
6
## DP: See https://bugs.launchpad.net/bugs/6760
 
7
 
 
8
@DPATCH@
 
9
diff -Naur screen-4.0.3.orig/attacher.c screen-4.0.3/attacher.c
 
10
--- screen-4.0.3.orig/attacher.c        2008-06-01 23:39:48.000000000 +0200
 
11
+++ screen-4.0.3/attacher.c     2008-06-01 23:40:21.000000000 +0200
 
12
@@ -819,11 +819,15 @@
 
13
 #ifdef USE_PAM
 
14
   pam_handle_t *pamh = 0;
 
15
   int pam_error;
 
16
-#else
 
17
-  char *pass, mypass[16 + 1], salt[3];
 
18
 #endif
 
19
+  char *pass, mypass[16 + 1], salt[3];
 
20
+  int using_pam = 1;
 
21
 
 
22
-#ifndef USE_PAM
 
23
+#ifdef USE_PAM
 
24
+  if (!ppp->pw_uid)
 
25
+    {
 
26
+#endif
 
27
+  using_pam = 0;
 
28
   pass = ppp->pw_passwd;
 
29
   if (pass == 0 || *pass == 0)
 
30
     {
 
31
@@ -856,6 +860,8 @@
 
32
       pass = crypt(mypass, salt);
 
33
       pass = ppp->pw_passwd = SaveStr(pass);
 
34
     }
 
35
+#ifdef USE_PAM
 
36
+    }
 
37
 #endif
 
38
 
 
39
   debug("screen_builtin_lck looking in gcos field\n");
 
40
@@ -885,6 +891,8 @@
 
41
           AttacherFinit(SIGARG);
 
42
           /* NOTREACHED */
 
43
         }
 
44
+      if (using_pam)
 
45
+        {
 
46
 #ifdef USE_PAM
 
47
       PAM_conversation.appdata_ptr = cp1;
 
48
       pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh);
 
49
@@ -895,10 +903,13 @@
 
50
       PAM_conversation.appdata_ptr = 0;
 
51
       if (pam_error == PAM_SUCCESS)
 
52
        break;
 
53
-#else
 
54
-      if (!strncmp(crypt(cp1, pass), pass, strlen(pass)))
 
55
-       break;
 
56
 #endif
 
57
+        }
 
58
+      else
 
59
+       {
 
60
+          if (!strncmp(crypt(cp1, pass), pass, strlen(pass)))
 
61
+           break;
 
62
+       }
 
63
       debug("screen_builtin_lck: NO!!!!!\n");
 
64
       bzero(cp1, strlen(cp1));
 
65
     }