stages/*: change license to Apache 2.0
[dragora.git] / patches / shadow / shadow-no_rlogin
blob02f75e9dd21504676906da1b7679e978eac30fd0
1 --- libmisc/Makefile.am.orig    2011-11-18 18:23:28.000000000 -0300
2 +++ libmisc/Makefile.am 2012-10-29 19:08:34.000000000 -0300
3 @@ -44,7 +44,6 @@
4         pwdcheck.c \
5         pwd_init.c \
6         remove_tree.c \
7 -       rlogin.c \
8         root_flag.c \
9         salt.c \
10         setugid.c \
11 --- src/login.c.orig    2012-05-25 08:51:55.000000000 -0300
12 +++ src/login.c 2012-10-29 19:23:58.000000000 -0300
13 @@ -94,11 +94,6 @@
14  static bool pflg = false;
15  static bool fflg = false;
17 -#ifdef RLOGIN
18 -static bool rflg = false;
19 -#else                          /* RLOGIN */
20 -#define rflg false
21 -#endif                         /* !RLOGIN */
22  static bool hflg = false;
23  static bool preauth_flag = false;
25 @@ -158,9 +153,6 @@
26                 exit (1);
27         }
28         fprintf (stderr, _("       %s [-p] [-h host] [-f name]\n"), Prog);
29 -#ifdef RLOGIN
30 -       fprintf (stderr, _("       %s [-p] -r host\n"), Prog);
31 -#endif                         /* RLOGIN */
32         exit (1);
33  }
35 @@ -311,13 +303,6 @@
36                         hostname = optarg;
37                         reason = PW_TELNET;
38                         break;
39 -#ifdef RLOGIN
40 -               case 'r':
41 -                       rflg = true;
42 -                       hostname = optarg;
43 -                       reason = PW_RLOGIN;
44 -                       break;
45 -#endif                         /* RLOGIN */
46                 case 'p':
47                         pflg = true;
48                         break;
49 @@ -326,21 +311,12 @@
50                 }
51         }
53 -#ifdef RLOGIN
54 -       /*
55 -        * Neither -h nor -f should be combined with -r.
56 -        */
58 -       if (rflg && (hflg || fflg)) {
59 -               usage ();
60 -       }
61 -#endif                         /* RLOGIN */
63         /*
64          * Allow authentication bypass only if real UID is zero.
65          */
67 -       if ((rflg || fflg || hflg) && !amroot) {
68 +       if ((fflg || hflg) && !amroot) {
69                 fprintf (stderr, _("%s: Permission denied.\n"), Prog);
70                 exit (1);
71         }
72 @@ -355,11 +331,6 @@
73                 ++optind;
74         }
76 -#ifdef RLOGIN
77 -       if (rflg && (NULL != username)) {
78 -               usage ();
79 -       }
80 -#endif                         /* RLOGIN */
81         if (fflg && (NULL == username)) {
82                 usage ();
83         }
84 @@ -519,9 +490,6 @@
85         const char *tmptty;
86         char tty[BUFSIZ];
88 -#ifdef RLOGIN
89 -       char term[128] = "";
90 -#endif                         /* RLOGIN */
91  #if defined(HAVE_STRFTIME) && !defined(USE_PAM)
92         char ptime[80];
93  #endif
94 @@ -597,7 +565,7 @@
95         is_console = console (tty);
96  #endif
98 -       if (rflg || hflg) {
99 +       if (hflg) {
100                 /*
101                  * Add remote hostname to the environment. I think
102                  * (not sure) I saw it once on Irix.  --marekm
103 @@ -610,19 +578,6 @@
104         if (hflg) {
105                 reason = PW_RLOGIN;
106         }
107 -#ifdef RLOGIN
108 -       if (rflg) {
109 -               assert (NULL == username);
110 -               username = xmalloc (USER_NAME_MAX_LENGTH + 1);
111 -               username[USER_NAME_MAX_LENGTH] = '\0';
112 -               if (do_rlogin (hostname, username, USER_NAME_MAX_LENGTH, term, sizeof term)) {
113 -                       preauth_flag = true;
114 -               } else {
115 -                       free (username);
116 -                       username = NULL;
117 -               }
118 -       }
119 -#endif                         /* RLOGIN */
121         OPENLOG ("login");
123 @@ -657,11 +612,6 @@
124                 }
125         }
127 -#ifdef RLOGIN
128 -       if (term[0] != '\0') {
129 -               addenv ("TERM", term);
130 -       } else
131 -#endif                         /* RLOGIN */
132         {
133                 /* preserve TERM from getty */
134                 if (!pflg) {
135 @@ -678,7 +628,7 @@
136                 set_env (argc - optind, &argv[optind]);
137         }
139 -       if (rflg || hflg) {
140 +       if (hflg) {
141                 cp = hostname;
142  #ifdef HAVE_STRUCT_UTMP_UT_HOST
143         } else if ((NULL != utent) && ('\0' != utent->ut_host[0])) {
144 @@ -1082,7 +1032,7 @@
145                 (void) puts (_("Login incorrect"));
147                 /* allow only one attempt with -r or -f */
148 -               if (rflg || fflg || (retries <= 0)) {
149 +               if (fflg || (retries <= 0)) {
150                         closelog ();
151                         exit (1);
152                 }