Patch #: 192 Type: operational change Priority: none Modification: update lwrename program, add manual entry Submitted: Phil Farrell Archived: munnari.OZ.AU mac/cap.patches/cap60.patch192 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch192' File: cap60/contrib/lwrename.c File: cap60/man/lwrename.8 *** contrib/lwrename.c.orig Fri Jan 15 00:14:21 1993 --- contrib/lwrename.c Wed Feb 16 18:18:44 1994 *************** *** 1,8 **** /* * Copyright (c) 1990, The Regents of the University of California. ! * Edward Moy, Workstation Software Support Group, Workstation Support Services, ! * Information Systems and Technology. ! * * Permission is granted to any individual or institution to use, copy, * or redistribute this software so long as it is not sold for profit, * provided that this notice and the original copyright notices are --- 1,32 ---- /* + * lwrename - daemon to hide printers on AppleTalk network by resetting + * AppleTalk type value. + * + * Syntax: lwrename [-t min ] [-s] [-r] [lwrenamefile] + * + * Options: + * -t min Specify how many integer minutes to sleep in between each + * sweep of the network looking for the monitored printers. + * Default=2 minutes + * + * -s Make a single sweep only looking for monitored printers; + * wait the sleep time; reset printers if "-r" option also + * specified; and exit. Use for testing. + * + * -r Reset printers back to original types before exiting. + * Only has effect if used in combination with "-s" flag. + * To force normal daemon to reset printers and exit, + * send it the HUP signal. + * + * lwrenamefile Pathname of the file containing the list of + * printers to be monitored (see format below). + * Default=LWRENAMEFILE compile-time flag or + * "/etc/lwrename.list" if no compile-time flag. + * * Copyright (c) 1990, The Regents of the University of California. ! * Edward Moy, Workstation Software Support Group, Workstation Support ! * Services, Information Systems and Technology. ! * * Permission is granted to any individual or institution to use, copy, * or redistribute this software so long as it is not sold for profit, * provided that this notice and the original copyright notices are *************** *** 9,14 **** --- 33,94 ---- * retained. The University of California makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. + * + * Revised Dec 15, 1993 by P. Farrell, Stanford Univ. Earth Sciences. + * Add "-s" and "-r" options for testing, and ability to specify + * printer list filename on command line. Add optional 3rd field + * to printer list records to specify new AppleTalk type for each + * printer, or default to new compile-time flag LWRENAMETYPE + * (value must be in quotes, defaults to "LaserShared"). Add + * documentation and lwrename.8 man page. General cleanup. + * + * Use lwrename to "capture" LaserWriter or equivalent PostScript printers + * on an AppleTalk network by renaming their AppleTalk type to a value + * known only to the CAP host, which can then run a lwsrv process as + * a spooler for that printer. Because many printers store AppleTalk type + * changes in normal RAM, they return to default value "LaserWriter" + * when power-cycled. Lwrename automates the process of watching for + * such printers and forcing the type change whenever they are found + * back with their old type. + * + * The list of printers to be monitored is stored in the file specified by + * the compile-time option LWRENAMEFILE (default value /etc/lwrename.list). + * Comment lines are allowed in this file; start them with the # character. + * Include one line per printer with three tab-separated fields in this format: + * passwordprinter_NBP_namenewtype + * Password is an integer value, either the factory default of 0, or a + * value you have previously set by another means. Printer_NBP_name is + * the full name needed to find it on the network, with its original + * (default) type, in this format: + * name:type@zone + * Use * for current or default zone. Newtype is an optional third field + * specifying the new AppleTalk type to be used when renaming the + * printer. WARNING: any trailing blanks on the line after "newtype" + * will be interpreted as part of the type name! If you omit "newtype" + * (be sure to leave off the before it as well) for a particular + * printer, it reverts to the compile time option LWRENAMETYPE, or to + * "LaserShared" if that option was not specified at compile time. + * + * Lwrename sleeps a user-specified number of minutes between each network + * "sweep". It runs forever until killed, unless you specify the "-s" + * flag to run one sweep only for testing. If you send it the HUP signal, + * or use the "-r" flag with the "-s" flag, it will first restore the + * original type to all of the printers it is monitoring before exiting. + * Any other kill signal just kills it without resetting any printer + * types. + * + * Lwrename does not need to run from the root account, although you may + * want to so restrict it to prevent private users from battling to + * control printers on the network. If your AppleTalk access method + * requires special privilege (e.g., the packetfilter under Ultrix), make + * sure lwrename executes under the appropriate user or group. Generally, + * you would start lwrename from your start-cap-servers file. + * + * There is no way to dynamically update the list of printers to be + * monitored by lwrename. To change the printer list, kill lwrename with + * the -HUP signal (to restore the current list of printers to original + * type); edit the list; and then restart lwrename. + * */ #include *************** *** 28,44 **** #define ATPRESPONSETIMEOUT sectotick(60*2) #define MINUTES * 60 - #define PASSWORD 7734 #define R_BUFMAX PAPSegSize*atpMaxNum struct lws { struct lws *next; char *passwd; char *name; } *lwhead; u_long atpresponsetimeout = ATPRESPONSETIMEOUT; ! char lwfile[] = LWRENAMEFILE; char *myname; char renamestr[] = "\ currentfile\n\ --- 108,161 ---- #define ATPRESPONSETIMEOUT sectotick(60*2) #define MINUTES * 60 #define R_BUFMAX PAPSegSize*atpMaxNum + #define LWRENAMEBUFSIZ 1024 + /* + * LWRENAMEFILE is location of configuration file specifying + * LaserWriters to be renamed. File has one line per printer, in + * this format: + * passwordprinter_NBP_namenewtype + * Password is usually the number 0 unless you have reset it. + * Printer_NBP_name is the full name needed to find it on the + * network, in this format: + * name:type@zone + * (use * for current or default zone). + * Newtype is the optional new AppleTalk type to use when renaming this + * printer; if not specified, defaults to LWRENAMETYPE (see below). + * Comment lines are allowed, start with # character. + * + */ + + #ifndef LWRENAMEFILE + #define LWRENAMEFILE "/etc/lwrename.list" + #endif LWRENAMEFILE + + /* + * LWRENAMETYPE macro is the default new AppleTalk type name to be used + * to hide the LaserWriters. Specific types for each printer can be + * specified in the LWRENAMEFILE list. + * + */ + + #ifndef LWRENAMETYPE + #define LWRENAMETYPE "LaserShared" + #endif LWRENAMETYPE + + /* + * Structure used to create linked list of printers to monitor. + * + */ + struct lws { struct lws *next; char *passwd; char *name; + char *newtype; } *lwhead; u_long atpresponsetimeout = ATPRESPONSETIMEOUT; ! char lwfile[256] = LWRENAMEFILE; char *myname; char renamestr[] = "\ currentfile\n\ *************** *** 48,54 **** 85f6ba98b8147bdb3c41fc154e390200521caba043febd65f48e008d42590001cd0f62e4c9f2b841c6c1c85660f30002ba262234d72494f203c119951000000376b481858e01bff2db172cf2ecfe000446e2f3ddca7b1fb2d27814e1c22e000598f64cae7bb9897afb760a5d81ac0106>\n\ serverdict begin %s exitserver\n\ statusdict begin\n\ ! (%s) (LaserShared) currentdict /appletalktype known\n\ {/appletalktype}{/product}ifelse exch def setprintername\n\ end\n\ "; --- 165,171 ---- 85f6ba98b8147bdb3c41fc154e390200521caba043febd65f48e008d42590001cd0f62e4c9f2b841c6c1c85660f30002ba262234d72494f203c119951000000376b481858e01bff2db172cf2ecfe000446e2f3ddca7b1fb2d27814e1c22e000598f64cae7bb9897afb760a5d81ac0106>\n\ serverdict begin %s exitserver\n\ statusdict begin\n\ ! (%s) (%s) currentdict /appletalktype known\n\ {/appletalktype}{/product}ifelse exch def setprintername\n\ end\n\ "; *************** *** 74,151 **** int argc; char **argv; { ! register char *cp; register FILE *fp; register struct lws *lp, *ln; register int i; int cno, ocomp, wcomp; ! char buf[BUFSIZ]; PAPStatusRec status; char *malloc(); long atol(); ! if(myname = rindex(*argv, '/')) myname++; else myname = *argv; ! for(argc--, argv++ ; argc > 0 && **argv == '-' ; argc--, argv++) { ! switch((*argv)[1]) { ! case 't': ! if((*argv)[2]) ! s_time = atoi(&(*argv)[2]); ! else if(argc < 2) ! Usage(); /* never returns */ ! else { ! argc--; ! s_time = atoi(*++argv); ! } ! if(s_time <= 0) ! Usage(); ! s_time *= 60; ! break; ! default: ! Usage(); /* never returns */ ! } ! } ! if(argc > 0) Usage(); /* never returns */ ! if((fp = fopen(lwfile, "r")) == NULL) { fprintf(stderr, "%s: can't open %s\n", myname, lwfile); exit(1); } ln = NULL; i = 0; ! while(fgets(buf, BUFSIZ, fp)) { i++; ! if(*buf == '#') /* allow comments */ continue; ! if(cp = index(buf, '\n')) ! *cp = 0; ! if((cp = index(buf, '\t')) == NULL) { fprintf(stderr, "%s: Syntax error in %s, line %d\n", myname, lwfile, i); exit(1); } ! *cp++ = 0; ! if((lp = (struct lws *)malloc(sizeof(struct lws))) == NULL) { fprintf(stderr, "%s: Out of memory\n", myname); exit(1); } lp->passwd = isnumber(buf) ? newstring(buf) : newpsstring(buf); ! lp->name = newstring(cp); ! if(ln) ln->next = lp; else lwhead = lp; ln = lp; ! } ! if(lwhead == NULL) { fprintf(stderr, "%s: No entries in %s\n", myname, lwfile); exit(1); } ln->next = NULL; fclose(fp); ! disassociate(); signal(SIGHUP, reset); /* init cap */ abInit(FALSE); /* don't printout -- messes up with */ nbpInit(); --- 191,360 ---- int argc; char **argv; { ! register char *cp, *tp; register FILE *fp; register struct lws *lp, *ln; register int i; + int sflag = 0; + int rflag = 0; int cno, ocomp, wcomp; ! /* ! * buf is used to read list lines ! * and set up PostScript to send ! * ! */ ! char buf[LWRENAMEBUFSIZ]; PAPStatusRec status; char *malloc(); long atol(); ! if (myname = rindex(*argv, '/')) myname++; else myname = *argv; ! ! /* ! * Parse the arguments ! * ! */ ! for (argc--, argv++ ; argc > 0 ; argc--, argv++) { ! switch ((*argv)[0]) { /* option or filename? */ ! case '-': ! switch ((*argv)[1]) { /* see which option is given */ ! case 't': ! if ((*argv)[2]) ! s_time = atoi(&(*argv)[2]); ! else if (argc < 2) ! Usage(); /* never returns */ ! else { ! argc--; ! s_time = atoi(*++argv); ! } ! if (s_time <= 0) ! Usage(); ! s_time *= 60; ! break; ! case 's': ! sflag = 1; ! break; ! case 'r': ! rflag = 1; ! break; ! default: ! Usage(); /* never returns */ ! } /* end see which option is given */ ! break; ! default: /* doesn't start with -, not an option */ ! strcpy(lwfile,*argv); ! } /* end option or filename? */ ! } /* end parse arguments */ ! ! if (argc > 0) /* leftover unexpected arguments */ Usage(); /* never returns */ ! ! /* ! * Open the monitored printer list file. ! * ! */ ! if ((fp = fopen(lwfile, "r")) == NULL) { fprintf(stderr, "%s: can't open %s\n", myname, lwfile); exit(1); } + + /* + * Read the file with list of printers to rename and store information + * in linked list. + * + */ ln = NULL; i = 0; ! while (fgets(buf, LWRENAMEBUFSIZ, fp)) { i++; ! if (*buf == '#') /* allow comments */ continue; ! if (cp = index(buf, '\n')) ! *cp = '\0'; /* change newline to string terminator */ ! ! /* ! * Find the three tab-separated sections of the line: ! * passwordprinter_NBP_namenewtype ! * Last field (newtype) is optional - will set to LWRENAMETYPE if ! * not specified. Use cp & tp pointers to mark off the sections ! * so can then copy them into new variables. ! * ! */ ! if ((cp = index(buf, '\t')) == NULL) { /* no tab after password */ fprintf(stderr, "%s: Syntax error in %s, line %d\n", myname, lwfile, i); exit(1); } ! *cp++ = '\0'; /* change tab to string terminator & advance cp */ ! ! /* ! * At least first 2 fields exist (minimum required), so allocate ! * memory for next element in linked list. ! * ! */ ! if ((lp = (struct lws *)malloc(sizeof(struct lws))) == NULL) { fprintf(stderr, "%s: Out of memory\n", myname); exit(1); } + + /* + * Fill in fields for this element of linked list of printers. + * + */ lp->passwd = isnumber(buf) ? newstring(buf) : newpsstring(buf); ! ! /* ! * Look for third optional new type field, and make sure it is not null. ! * ! */ ! if ((tp = index(cp, '\t')) == NULL) { /* no 3rd field, all 2nd field */ ! lp->name = newstring(cp); ! lp->newtype = newstring(LWRENAMETYPE); ! } else { /* 3rd field found, parse between 2nd & 3rd fields */ ! *tp++ = '\0'; /* change tab to string term. & advance tp */ ! if (*tp == '\0') { /* null 3rd field */ ! fprintf(stderr, "%s: Syntax error in %s, line %d\n", myname, lwfile, i); ! fprintf(stderr, "\t\ttrailing tab character at end of line\n"); ! exit(1); ! } /* quit if trailing tab at end */ ! lp->name = newstring(cp); ! lp->newtype = newstring(tp); ! } ! ! /* ! * Create the links between this element of list and others. ! * ! */ ! if (ln) ln->next = lp; else lwhead = lp; ln = lp; ! } /* end reading list of printers */ ! ! if (lwhead == NULL) { fprintf(stderr, "%s: No entries in %s\n", myname, lwfile); exit(1); } ln->next = NULL; fclose(fp); ! ! /* ! * Become a daemon, unless single sweep flag was specified ! * ! */ ! if (!sflag) ! disassociate(); ! ! /* ! * Set signal so that if HUP is received, calls "reset" to first put the ! * printer types back to their original values before exiting. ! * ! */ signal(SIGHUP, reset); + /* init cap */ abInit(FALSE); /* don't printout -- messes up with */ nbpInit(); *************** *** 152,176 **** PAPInit(); /* init PAP printer routines */ ATPSetResponseTimeout(atpresponsetimeout); /* set to 2 minutes */ ! for( ; ; ) { lp = lwhead; do { ! if(PAPOpen(&cno, lp->name, atpMaxNum, &status, &ocomp) == noErr) { do { abSleep(16, TRUE); ! } while(ocomp > 0); cp = index(lp->name, ':'); ! *cp = 0; ! sprintf(buf, renamestr, lp->passwd, lp->name); *cp = ':'; writeit(cno, buf); PAPClose(cno); ! } ! } while(lp = lp->next); sleep(s_time); ! } ! } void reset() { --- 361,419 ---- PAPInit(); /* init PAP printer routines */ ATPSetResponseTimeout(atpresponsetimeout); /* set to 2 minutes */ ! /* ! * Main loop tries to find each printer in input file list. ! * If found, renames AppleTalk type to specified or default new type. ! * Then sleeps as specified in argument before starting over. ! * Goes on forever until program is killed, unless single sweep flag ! * specified. ! * ! */ ! do { lp = lwhead; + /* + * Loop through each printer in the linked list. + * + */ do { ! /* ! * Open connection to printer. If found on net with original type, ! * reset to new type. ! * ! */ ! if (PAPOpen(&cno, lp->name, atpMaxNum, &status, &ocomp) == noErr) { do { abSleep(16, TRUE); ! } while (ocomp > 0); ! /* ! * Need name only (not type or zone) to substitute into rename string. ! * Setting the ":" after name to zero and back again does the trick. ! * ! */ cp = index(lp->name, ':'); ! *cp = '\0'; ! sprintf(buf ,renamestr ,lp->passwd ,lp->name ,lp->newtype); *cp = ':'; writeit(cno, buf); PAPClose(cno); ! } /* end if printer found on net */ ! } while (lp = lp->next); /* end of do-while loop */ sleep(s_time); ! } while (!sflag); /* end of loop */ ! if (rflag) ! reset(); /* only get here if single sweep flag was set */ ! exit(0); ! } /* end main */ + /* + * Reset function used to put things back before exiting. + * Will find the printers on the network that have + * been set to the new AppleTalk type and return them + * to their original types, as specified in LWRENAMEFILE list. + * Then exits the program. + * + */ + void reset() { *************** *** 178,208 **** register struct lws *lp; register int i; int cno, ocomp; ! char buf[BUFSIZ]; ! char name[256]; PAPStatusRec status; signal(SIGHUP, SIG_IGN); lp = lwhead; do { tp = index(lp->name, ':'); ! *tp++ = 0; ! strcpy(name, lp->name); ! strcat(name, ":LaserShared"); cp = index(tp, '@'); ! strcat(name, cp); ! *cp = 0; ! if(PAPOpen(&cno, name, atpMaxNum, &status, &ocomp) == noErr) { do { abSleep(16, TRUE); ! } while(ocomp > 0); ! sprintf(buf, resetstr, lp->passwd, lp->name, tp); writeit(cno, buf); PAPClose(cno); } ! } while(lp = lp->next); ! exit(0); ! } disassociate() { --- 421,494 ---- register struct lws *lp; register int i; int cno, ocomp; ! char buf[LWRENAMEBUFSIZ]; ! char NBPname[256]; ! char origname[256]; ! char origtype[256]; PAPStatusRec status; signal(SIGHUP, SIG_IGN); lp = lwhead; + /* + * Run once through all printers in the linked list. + * + */ do { + /* + * Create NBP name to search for on network. This has the new type + * that has been previously set by this program. + * + * Pick up name section only from lp->name by trick of finding colon + * and temporarily resetting it to 0. Also save name part alone into + * a variable to substitute into the reset string. + * + */ tp = index(lp->name, ':'); ! *tp = '\0'; ! strcpy(origname, lp->name); ! strcpy(NBPname, lp->name); ! *tp = ':'; ! ! /* ! * Now add new type as the type. ! * ! */ ! strcat(NBPname, ":"); ! strcat(NBPname, lp->newtype); ! ! /* ! * Save off the original AppleTalk type (from the linked list of ! * printers) to use in the reset string. ! * ! */ ! tp++; /* go past colon */ cp = index(tp, '@'); ! *cp = '\0'; ! strcpy(origtype, tp); /* everything past colon up to @ sign */ ! *cp = '@'; ! ! /* ! * Finally, get the zone. ! * ! */ ! strcat(NBPname, cp); /* everything from @ sign to end */ ! ! /* ! * Open connection to printer. If found, send reset string to put ! * back to original type. ! * ! */ ! if (PAPOpen(&cno, NBPname, atpMaxNum, &status, &ocomp) == noErr) { do { abSleep(16, TRUE); ! } while (ocomp > 0); ! sprintf(buf, resetstr, lp->passwd, origname, origtype); writeit(cno, buf); PAPClose(cno); } ! } while (lp = lp->next); /* end of do-while loop */ ! exit(0); /* done resetting back to original, exit the program */ ! } /* end reset function */ disassociate() { *************** *** 210,216 **** if (fork()) _exit(0); /* kill parent */ ! for (i=0; i < 3; i++) close(i); /* kill */ (void)open("/",0); (void)dup2(0,1); (void)dup2(0,2); --- 496,503 ---- if (fork()) _exit(0); /* kill parent */ ! for (i=0; i < 3; i++) ! close(i); /* kill */ (void)open("/",0); (void)dup2(0,1); (void)dup2(0,2); *************** *** 285,291 **** * return: -1 paperr * 0 ok * 1 eof ! */ handleread(cno) { int paperr; --- 572,580 ---- * return: -1 paperr * 0 ok * 1 eof ! * ! */ ! handleread(cno) { int paperr; *************** *** 319,325 **** register char *cp; char *malloc(); ! if((cp = malloc(strlen(str) + 1)) == NULL) { fprintf(stderr, "%s: newstring: Out of memory\n", myname); exit(1); } --- 608,614 ---- register char *cp; char *malloc(); ! if ((cp = malloc(strlen(str) + 1)) == NULL) { fprintf(stderr, "%s: newstring: Out of memory\n", myname); exit(1); } *************** *** 337,352 **** tp = buf; *tp++ = '('; ! for(len = 1, fp = str ; *fp ; ) { ! if(++len >= (sizeof(buf) - 1)) { fprintf(stderr, "%s: newpsstring: String too long\n", myname); exit(1); } ! switch(*fp) { case '(': case ')': case '\\': ! if(++len >= (sizeof(buf) - 1)) { fprintf(stderr, "%s: newpsstring: String too long\n", myname); exit(1); } --- 626,641 ---- tp = buf; *tp++ = '('; ! for (len = 1, fp = str ; *fp ; ) { ! if (++len >= (sizeof(buf) - 1)) { fprintf(stderr, "%s: newpsstring: String too long\n", myname); exit(1); } ! switch (*fp) { case '(': case ')': case '\\': ! if (++len >= (sizeof(buf) - 1)) { fprintf(stderr, "%s: newpsstring: String too long\n", myname); exit(1); } *************** *** 362,369 **** isnumber(str) register char *str; { ! while(*str) { ! if(!isdigit(*str)) return(0); str++; } --- 651,658 ---- isnumber(str) register char *str; { ! while (*str) { ! if (!isdigit(*str)) return(0); str++; } *************** *** 372,377 **** Usage() { ! fprintf(stderr, "Usage: %s [-t minutes]\n", myname); exit(1); } --- 661,666 ---- Usage() { ! fprintf(stderr, "Usage: %s [-t minutes] [-s] [printer_list_file]\n", myname); exit(1); } *** man/lwrename.8.orig Wed Feb 16 17:55:18 1994 --- man/lwrename.8 Wed Feb 16 18:17:32 1994 *************** *** 0 **** --- 1,168 ---- + .TH lwrename 8L "17 Dec 1993" "Stanford Earth Sciences" + .SH NAME + lwrename \- daemon to hide printers on AppleTalk network by resetting + AppleTalk type value. + .SH SYNOPSIS + .B lwrename + .RI "[\-t " minutes ] + [\-s] [\-r] + .RI [ lwrenamefile ] + .SH OPTIONS + .TP + .BI "\-t " minutes + Specify how many integer minutes to sleep in between each + sweep of the network looking for the monitored printers. + Default=2 minutes. + .TP + .B \-s + Do not run as a background daemon. + Only make a single sweep looking for and changing type on monitored + printers; wait the sleep time; reset printers to original types if + "\-r" option also specified; and exit. + Use for testing. + .TP + .B \-r + If running a single sweep with \-s option, first reset printers to + original types before exiting. + No effect unless \-s also specified. + Use for testing. + To make a normal + .I lwrename + background daemon reset printers and exit, send it the HUP signal. + .TP + .I lwrenamefile + Pathname of the file containing the list of printers to be monitored + (see format below). + Default=LWRENAMEFILE compile-time flag or "/etc/lwrename.list" if no + compile-time flag. + .SH DESCRIPTION + .I lwrename + is part of the CAP software for AppleTalk network access from + UNIX systems. + It is used by a UNIX host to "capture" LaserWriter (or equivalent + PostScript) printers on the network so that they are not directly + visible to Macintosh or other computers on the network. + Then an + .I lwsrv + daemon on the UNIX host can advertise the printer and create a spooler + for it. + This is particularly useful if you are using one of the authentication + options in + .I lwsrv + to restrict access to the printer or provide accounting by user name. + To capture the printer, you must send the appropriate PostScript code + to it to change its network type value to something other than + "LaserWriter". + Then it cannot be seen by the Macintosh, at least not with standard + printer drivers. + This is no protection against hackers who know how to modify the + Macintosh driver with ResEdit, etc. + .PP + Unfortunately, many printers store changes to their network type + in ordinary RAM that gets reset back to the default "LaserWriter" after + every power cycle. + For these printers, sending the appropriate PostScript code once is + not good enough. + You have to keep checking to see if the printer has reverted to its + default type and then rename it again. + .PP + .I lwrename + runs as a daemon process to automate this checking and renaming for you. + It periodically queries the AppleTalk network looking for any of a set + of PostScript printers listed in a file. + Whenever it finds one of these printers under its original + AppleTalk type of "LaserWriter" (or other type specified in the + file), it sends the appropriate PostScript code to rename the printer + to a new type that you specify in the file (or a default type + compiled into the program -- see below). + This way, after a printer power cycle resets the AppleTalk type + back to the default, + .I lwrename + will quickly find it and reset it to the "captured" value. + .PP + The list of printers to be monitored is stored in a file. + The pathname of this file can be given as an optional command line + argument; if no argument is given, the compile-time option LWRENAMEFILE + will be used as the pathname, or the name "/etc/lwrename.list" if that + option was not specified at compile time. + Comment lines are allowed in this file; start them with the # character. + One line defines each printer; tab characters are used to parse the + line into three fields. The third field is optional; if you omit it, + be sure also to omit the tab character before it. The format for + each printer description line is: + .br + passwordprinter_NBP_namenewtype + .br + Password is an integer value, either the factory default of 0, or a + value you have previously set by another means. + Printer_NBP_name is the full NBP name needed to find the printer on the + network, with its original (default) type, in this format: + .br + name:type@zone + .br + Use * for the current or default zone. + Newtype is an optional third field specifying the new AppleTalk type to + be used when renaming the printer. If you omit this field, be sure + to omit the tab before it. + WARNING: any trailing blanks on the line after "newtype" + will be interpreted as part of the type name! + If newtype is not specified for a particular printer, it reverts to the + compile-time option LWRENAMETYPE, or to "LaserShared" if that option + was not specified at compile time. + .PP + When first started, + .I lwrename + will automatically fork itself into the background, unless the + "\-s" flag is specified (for testing). + It will sleep between each network "sweep" for the number of + minutes specified in the optional "\-t" argument, or for two minutes + if no argument is given. + It runs forever until killed, unless you specify the "\-s" flag + to run one sweep only for testing. + If you send it the HUP signal (or if you specify the "\-r" flag with + the "\-s" flag), it will first restore the original type to all of the + printers it is monitoring before exiting. + Any other kill signal just kills it without resetting any printer types. + .PP + .I lwrename + does not need to run from the root account, although you may + want to so restrict it to prevent private users from battling to + control printers on the network. + If your AppleTalk access method requires special privilege (e.g., the + packetfilter under Ultrix), make sure + .I lwrename + executes under the appropriate user or group. + Also, if you have set printer passwords, you probably want to change + permissions on the printer list file to limit read access to the + root or manager account. + Generally, you would start + .I lwrename + from your + .I start\-cap\-servers + file. + .SH FILES + /etc/lwrename.list default location for list of monitored printers + .SH SEE ALSO + CAP(8), atlook(1), lwsrv(8) + .SH AUTHOR + Edward Moy, Workstation Software Support Group, Workstation Support Services, + Information Systems and Technology, University of California. + .PP + Revisions and manual page by Phil Farrell, Stanford University + School of Earth Sciences. + .PP + See source code for copyright and distribution restrictions. + .SH BUGS + There is no error checking for correct syntax in the list of printers, + except to verify that at least one tab is present to separate the + required first and second fields. + Be careful or you may get strange results. + .PP + There is no way to dynamically update the list of printers to be + monitored by + .I lwrename. + To change the printer list, kill + .I lwrename + with the HUP signal (to restore the current list of printers to + original type); edit the list; and then restart + .I lwrename. *** lib/cap/abversion.c.orig Wed Feb 16 16:13:44 1994 --- lib/cap/abversion.c Wed Feb 16 18:21:18 1994 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1994/02/16 05:13:39 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.91 1994/02/16 05:13:39 djh Rel djh $ ! * $Revision: 2.91 $ * */ --- 1,7 ---- /* ! * $Author: djh $ $Date: 1994/02/16 07:21:11 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.92 1994/02/16 07:21:11 djh Rel djh $ ! * $Revision: 2.92 $ * */ *************** *** 32,38 **** myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 191; myversion.cv_rmonth = "February"; myversion.cv_ryear = "1994"; switch (lap_proto) { --- 32,38 ---- myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 192; myversion.cv_rmonth = "February"; myversion.cv_ryear = "1994"; switch (lap_proto) { *** README.orig Wed Feb 16 16:14:24 1994 --- README Wed Feb 16 18:22:06 1994 *************** *** 2,8 **** CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 191, February 1994 Notice ------ --- 2,8 ---- CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 192, February 1994 Notice ------