~ubuntu-branches/ubuntu/trusty/screen/trusty-backports

« back to all changes in this revision

Viewing changes to debian/patches/07_norootpassword.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-10-23 17:36:30 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20071023173630-6q4agogsxuzujhwd
Tags: 4.0.3-7ubuntu1
* Merge with Debian; remaining Ubuntu changes:
  - 07_norootpassword.dpatch: When locking a root-owned screen, check that
    root has a password set. If not, ask for an unlocking key. (LP#6760)
  - debian/preinst: Remove obsolete init script 'screen' on
    upgrades. The script is called 'screen-cleanup' in Debian and thus
    should be called the same in Ubuntu to avoid a permanent and pointless
    delta. This needs to be kept until after the next LTS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 07_norootpassword.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
--- screen-4.0.3.orig/attacher.c
 
10
+++ screen-4.0.3/attacher.c
 
11
@@ -806,11 +806,15 @@
 
12
 #ifdef USE_PAM
 
13
   pam_handle_t *pamh = 0;
 
14
   int pam_error;
 
15
-#else
 
16
-  char *pass, mypass[16 + 1], salt[3];
 
17
 #endif
 
18
+  char *pass, mypass[16 + 1], salt[3];
 
19
+  int using_pam = 1;
 
20
 
 
21
-#ifndef USE_PAM
 
22
+#ifdef USE_PAM
 
23
+  if (!ppp->pw_uid)
 
24
+    {
 
25
+#endif
 
26
+  using_pam = 0;
 
27
   pass = ppp->pw_passwd;
 
28
   if (pass == 0 || *pass == 0)
 
29
     {
 
30
@@ -843,6 +847,8 @@
 
31
       pass = crypt(mypass, salt);
 
32
       pass = ppp->pw_passwd = SaveStr(pass);
 
33
     }
 
34
+#ifdef USE_PAM
 
35
+    }
 
36
 #endif
 
37
 
 
38
   debug("screen_builtin_lck looking in gcos field\n");
 
39
@@ -872,6 +878,8 @@
 
40
           AttacherFinit(SIGARG);
 
41
           /* NOTREACHED */
 
42
         }
 
43
+      if (using_pam)
 
44
+        {
 
45
 #ifdef USE_PAM
 
46
       PAM_conversation.appdata_ptr = cp1;
 
47
       pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh);
 
48
@@ -882,10 +890,13 @@
 
49
       PAM_conversation.appdata_ptr = 0;
 
50
       if (pam_error == PAM_SUCCESS)
 
51
        break;
 
52
-#else
 
53
-      if (!strncmp(crypt(cp1, pass), pass, strlen(pass)))
 
54
-       break;
 
55
 #endif
 
56
+        }
 
57
+      else
 
58
+       {
 
59
+          if (!strncmp(crypt(cp1, pass), pass, strlen(pass)))
 
60
+           break;
 
61
+       }
 
62
       debug("screen_builtin_lck: NO!!!!!\n");
 
63
       bzero(cp1, strlen(cp1));
 
64
     }