[704] in Zephyr_Bugs
realm switch for zwrite
daemon@ATHENA.MIT.EDU (Derrick J. Brashear)
Wed Sep 13 11:09:44 1995
Date: Wed, 13 Sep 1995 11:09:36 -0400 (EDT)
From: "Derrick J. Brashear" <shadow@DEMENTIA.ORG>
Reply-To: "Derrick J. Brashear" <shadow@DEMENTIA.ORG>
To: bug-zephyr@MIT.EDU
---2143855796-1027100827-811004977=:14990
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Hi,
The attached patch implements the "-r realm" switch in zwrite. Additionally, it
makes use of the ZExpandRealm function I sent you in an earlier patch to expnad
the realm name. Perhaps in the future ZExpandRealm should be called elsewhere,
but this is the current state of things. Take this if you want it, if not
please feel free to drop it. It may be useful in the future.
-D
---2143855796-1027100827-811004977=:14990
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: zwrite-rlm.diff
*** zwrite.c.orig Tue Sep 12 18:18:29 1995
--- zwrite.c Wed Sep 13 11:01:36 1995
***************
*** 29,34 ****
--- 29,39 ----
#define MAXRECIPS 100
+ #ifdef CMU_INTERREALM
+ char *rlmarg;
+ char rlmbuf[BUFSIZ];
+ #endif /* INTERREALM */
+
int nrecips, msgarg, verbose, quiet, nodot;
char *whoami, *inst, *class, *opcode, *recips[MAXRECIPS];
Z_AuthProc auth;
***************
*** 59,64 ****
--- 64,72 ----
auth = ZAUTH;
verbose = quiet = msgarg = nrecips = nocheck = filsys = nodot = 0;
tabexpand = 1;
+ #ifdef CMU_INTERREALM
+ rlmarg = 0;
+ #endif /* INTERREALM */
if (class = ZGetVariable("zwrite-class")) {
(void) strcpy(classbfr, class);
***************
*** 170,175 ****
--- 178,191 ----
arg++;
format = argv[arg];
break;
+ #ifdef CMU_INTERREALM
+ case 'r':
+ if (arg == argc-1)
+ usage(whoami);
+ arg++;
+ rlmarg = argv[arg];
+ break;
+ #endif /* INTERREALM */
default:
usage(whoami);
}
***************
*** 184,189 ****
--- 200,211 ----
usage(whoami);
}
+ #ifdef CMU_INTERREALM
+ if (rlmarg) {
+ strcpy(rlmbuf, ZExpandRealm(rlmarg));
+ }
+ #endif /* INTERREALM */
+
if (!signature) {
/* try to find name in the password file */
register struct passwd *pwd;
***************
*** 315,325 ****
--- 337,368 ----
int i, success, retval;
char bfr[BUFSIZ];
ZNotice_t retnotice;
+ #ifdef CMU_INTERREALM
+ char rlmrecip[BUFSIZ];
+ char *cp;
+ #endif /* INTERREALM */
success = 0;
for (i=0;i<nrecips || !nrecips;i++) {
+ #ifdef CMU_INTERREALM
+ if (rlmarg) {
+ sprintf(rlmrecip, "%s@%s", nrecips?recips[i]:"", rlmbuf);
+ notice->z_recipient = rlmrecip;
+ } else {
+ if (nrecips && (cp = strchr(recips[i], '@'))) {
+ strcpy(rlmrecip, recips[i]);
+ cp = strchr(rlmrecip, '@');
+ *cp++;
+ strcpy(cp, ZExpandRealm(cp));
+ notice->z_recipient = rlmrecip;
+ } else {
+ #endif
notice->z_recipient = nrecips?recips[i]:"";
+ #ifdef CMU_INTERREALM
+ }
+ }
+ #endif
if (verbose && real)
printf("Sending %smessage, class %s, instance %s, to %s\n",
auth?"authenticated ":"",
***************
*** 401,410 ****
--- 444,461 ----
usage(s)
char *s;
{
+ #ifdef CMU_INTERREALM
fprintf(stderr,
"Usage: %s [-a] [-o] [-d] [-v] [-q] [-n] [-t] [-u] [-l]\n\
+ \t[-r realm]\
\t[-c class] [-i inst] [-O opcode] [-f fsname] [-s signature]\n\
\t[user ...] [-F format] [-m message]\n", s);
+ #else
+ fprintf(stderr,
+ "Usage: %s [-a] [-o] [-d] [-v] [-q] [-n] [-t] [-u] [-l]\n\
+ \t[-c class] [-i inst] [-O opcode] [-f fsname] [-s signature]\n\
+ \t[user ...] [-F format] [-m message]\n", s);
+ #endif
fprintf(stderr,"\t-f and -c are mutually exclusive\n\
\t-f and -i are mutually exclusive\n\
\trecipients must be specified unless -c or -f specifies a class\n\
---2143855796-1027100827-811004977=:14990--