summaryrefslogtreecommitdiffstats
path: root/eBones/passwd/HOW-TO
blob: aad3b9c06e9704c72dcd22b9b5c6f7059bbe9eb8 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Here's how to regenerate this from the original eBones:

1) Copy kpasswd.c from the admin directory.
2) perl -spi.bak -e 's/\$(Header[^\$]*)\$/$1/g' *.[ch]
3) Apply the following patch:

*** /home/wollman/kpasswd.orig/kpasswd.c	Fri Jan 20 16:01:36 1995
--- kpasswd.c	Fri Jan 20 16:29:57 1995
***************
*** 1,10 ****
  /*
-  * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v $
-  * $Author: jtkohl $
-  *
   * Copyright 1988 by the Massachusetts Institute of Technology.
   *
   * For copying and distribution information, please see the file
!  * <mit-copyright.h>.
   *
   * change your password with kerberos
--- 1,7 ----
  /*
   * Copyright 1988 by the Massachusetts Institute of Technology.
   *
   * For copying and distribution information, please see the file
!  * Copyright.MIT.
   *
   * change your password with kerberos
***************
*** 12,20 ****
  
  #ifndef	lint
  static char rcsid_kpasswd_c[] =
      "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v 4.3 89/09/26 09:33:02 jtkohl Exp ";
  #endif	lint
  
- #include <mit-copyright.h>
  /*
   * kpasswd
--- 9,20 ----
  
  #ifndef	lint
+ #if 0
  static char rcsid_kpasswd_c[] =
      "BonesHeader: /afs/athena.mit.edu/astaff/project/kerberos/src/kadmin/RCS/kpasswd.c,v 4.3 89/09/26 09:33:02 jtkohl Exp ";
+ #endif
+ static const char rcsid[] =
+ 	"$Id$";
  #endif	lint
  
  /*
   * kpasswd
***************
*** 28,36 ****
  #include "kadm.h"
  
  extern void krb_set_tkt_string();
  
! main(argc,argv)
!   int argc;
!   char *argv[];
  {
      char name[ANAME_SZ];	/* name of user */
--- 28,38 ----
  #include "kadm.h"
  
+ #include "extern.h"
+ 
  extern void krb_set_tkt_string();
+ static void go_home(char *, int);
  
! 
! int krb_passwd(char *uname, char *iflag, char *rflag, char *uflag)
  {
      char name[ANAME_SZ];	/* name of user */
***************
*** 66,74 ****
  			    default_realm) != KSUCCESS) {
  	pw = getpwuid((int) getuid());
! 	if (pw)
! 	    (void) strcpy(default_name, pw->pw_name);
! 	else
  	    /* seems like a null name is kinda silly */
! 	    (void) strcpy(default_name, ""); 
  	strcpy(default_inst, "");
  	if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
--- 68,77 ----
  			    default_realm) != KSUCCESS) {
  	pw = getpwuid((int) getuid());
! 	if (pw) {
! 		strcpy(default_name, pw->pw_name);
! 	} else {
  	    /* seems like a null name is kinda silly */
! 		strcpy(default_name, ""); 
! 	}
  	strcpy(default_inst, "");
  	if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
***************
*** 76,85 ****
      }
  
!     while ((c = getopt(argc, argv, "u:n:i:r:h")) != EOF) {
! 	switch (c) {
! 	  case 'u':
! 	    if (status = kname_parse(name, inst, realm, optarg)) {
! 		fprintf(stderr, "Kerberos error: %s\n", krb_err_txt[status]);
! 		exit(2);
  	    }
  	    if (realm[0])
--- 79,85 ----
      }
  
!     if(uflag) {
! 	    if (status = kname_parse(name, inst, realm, uflag)) {
! 		    errx(2, "Kerberos error: %s", krb_err_txt[status]);
  	    }
  	    if (realm[0])
***************
*** 88,130 ****
  		if (krb_get_lrealm(realm, 1) != KSUCCESS)
  		    strcpy(realm, KRB_REALM);
! 	    break;
! 	  case 'n':
! 	    if (k_isname(optarg))
! 		(void) strncpy(name, optarg, sizeof(name) - 1);
! 	    else {
! 		fprintf(stderr, "Bad name: %s\n", optarg);
! 		usage(1);
! 	    }
! 	    break;
! 	  case 'i':
! 	    if (k_isinst(optarg))
! 		(void) strncpy(inst, optarg, sizeof(inst) - 1);
! 	    else {
! 		fprintf(stderr, "Bad instance: %s\n", optarg);
! 		usage(1);
  	    }
! 	    (void) strcpy(inst, optarg);
! 	    break;
! 	  case 'r':
! 	    if (k_isrealm(optarg)) {
! 		(void) strncpy(realm, optarg, sizeof(realm) - 1);
! 		realm_given++; 
  	    }
! 	    else {
! 		fprintf(stderr, "Bad realm: %s\n", optarg);
! 		usage(1);
  	    }
- 	    break;
- 	  case 'h':
- 	    usage(0);
- 	    break;
- 	  default:
- 	    usage(1);
- 	    break;
- 	}
- 	use_default = 0;
      }
!     if (optind < argc)
! 	usage(1);
  
      if (use_default) {
--- 88,119 ----
  		if (krb_get_lrealm(realm, 1) != KSUCCESS)
  		    strcpy(realm, KRB_REALM);
!     }
! 
!     if(uname) {
! 	    if (k_isname(uname)) {
! 		    strncpy(name, uname, sizeof(name) - 1);
! 	    } else {
! 		    errx(1, "bad name: %s", uname);
  	    }
!     }
! 
!     if(iflag) {
! 	    if (k_isinst(iflag)) {
! 		    strncpy(inst, iflag, sizeof(inst) - 1);
! 	    } else {
! 		    errx(1, "bad instance: %s", iflag);
  	    }
!     }
! 
!     if(rflag) {
! 	    if (k_isrealm(rflag)) {
! 		    strncpy(realm, rflag, sizeof(realm) - 1);
! 		    realm_given++; 
! 	    } else {
! 		    errx(1, "bad realm: %s", rflag);
  	    }
      }
! 
!     if(uname || iflag || rflag || uflag) use_default = 0;
  
      if (use_default) {
***************
*** 132,137 ****
  	strcpy(inst, default_inst);
  	strcpy(realm, default_realm);
!     }
!     else {
  	if (!name[0])
  	    strcpy(name, default_name);
--- 121,125 ----
  	strcpy(inst, default_inst);
  	strcpy(realm, default_realm);
!     } else {
  	if (!name[0])
  	    strcpy(name, default_name);
***************
*** 147,153 ****
      if ((status = kadm_init_link("changepw", KRB_MASTER, realm)) 
  	!= KADM_SUCCESS) 
! 	com_err(argv[0], status, "while initializing");
      else if ((status = kadm_change_pw(new_key)) != KADM_SUCCESS)
! 	com_err(argv[0], status, " attempting to change password.");
  
      if (status != KADM_SUCCESS)
--- 135,141 ----
      if ((status = kadm_init_link("changepw", KRB_MASTER, realm)) 
  	!= KADM_SUCCESS) 
! 	com_err("kpasswd", status, "while initializing");
      else if ((status = kadm_change_pw(new_key)) != KADM_SUCCESS)
! 	com_err("kpasswd", status, " attempting to change password.");
  
      if (status != KADM_SUCCESS)
***************
*** 225,237 ****
  }
  
! usage(value)
!   int value;
! {
!     fprintf(stderr, "Usage: ");
!     fprintf(stderr, "kpasswd [-h ] [-n user] [-i instance] [-r realm] ");
!     fprintf(stderr, "[-u fullname]\n");
!     exit(value);
! }
! 
  go_home(str,x)
    char *str;
--- 213,217 ----
  }
  
! static void
  go_home(str,x)
    char *str;
OpenPOWER on IntegriCloud