dmmartindale@watmath.UUCP (Dave Martindale) (12/12/84)
The news code is designed to let the local news administrator cancel any article they want, on their local machine only. However, it doesn't work in 2.10.2. The sequence of events goes something like this: Cancellation is done by posting a control message; only the originator of the article and the administrator are allowed to do so. When the control message is received (either locally, or an incoming network control message) it is checked. If it came from the originator, fine. To allow the news administrator to cancel things, it makes a special check for a newsgroup name prefixed by "to.". Perhaps this is how distribution used to be controlled, but the current code in cancel() specifies a distribution of "local" in the control message rather than changing the newsgroup name. Also, cancel_command() doesn't bother passing a "notauthor" flag to cancel() to cause it to generate the "local" distribution. Also, the control-message-handling code is prepared to let root, as well as the administrator, delete articles, but the code in readr.c isn't. The two should be made consistent. To get all this to work, control.c should be changed to check distribution instead of newsgroup name: *** /tmp/control.c Tue Dec 11 20:03:10 1984 --- control.c Tue Dec 11 20:05:44 1984 *************** *** 282,288 char *findhist(); register FILE *fp; char whatsisname[150]; - char msgng[64]; time_t t; int su = 0; --- 282,287 ----- char *findhist(); register FILE *fp; char whatsisname[150]; time_t t; int su = 0; *************** *** 289,295 if (argc < 1) xerror("cancel: Not enough arguments."); strcpy(whatsisname, senderof(&header)); - strcpy(msgng, header.nbuf); line = findhist(argv[1]); if (line == NULL) { log("Can't cancel %s: non-existent", argv[1]); --- 288,293 ----- if (argc < 1) xerror("cancel: Not enough arguments."); strcpy(whatsisname, senderof(&header)); line = findhist(argv[1]); if (line == NULL) { log("Can't cancel %s: non-existent", argv[1]); *************** *** 308,313 return; } else log("Cancelling %s", line); while (*p) { q = index(p, ' '); if (q) --- 306,313 ----- return; } else log("Cancelling %s", line); + if((uid==ROOTID||uid==0) && strcmp(header.distribution,"local") == 0) + su = 1; while (*p) { q = index(p, ' '); if (q) *************** *** 317,324 if (hread(&header, fp, TRUE) == NULL) xerror("Article is garbled."); fclose(fp); - if((uid==ROOTID||uid==0) && strncmp(msgng,"to.",3) == 0) - su = 1; poster = senderof(&header); /* only compare up to '.' or ' ' */ r = index(poster,'.'); --- 317,322 ----- if (hread(&header, fp, TRUE) == NULL) xerror("Article is garbled."); fclose(fp); poster = senderof(&header); /* only compare up to '.' or ' ' */ r = index(poster,'.'); ******************************************************************************* and readr.c should be changed to pass a "notauthor" flag: *** /tmp/readr.c Tue Dec 11 20:26:34 1984 --- readr.c Tue Dec 11 20:28:11 1984 *************** *** 594,599 cancel_command() { tfilename = filename; hptr = h; if (*bptr == '-') { --- 594,601 ----- cancel_command() { + int notauthor; + tfilename = filename; hptr = h; if (*bptr == '-') { *************** *** 609,615 ptr1 = index(rcbuf, ' '); if (ptr1) *ptr1 = 0; ! if (uid != ROOTID && strcmp(username, rcbuf)) { fprintf(ofp, "Can't cancel what you didn't write.\n"); return FALSE; } --- 611,618 ----- ptr1 = index(rcbuf, ' '); if (ptr1) *ptr1 = 0; ! notauthor = strcmp(username, rcbuf); ! if (notauthor && uid != ROOTID && uid != 0) { fprintf(ofp, "Can't cancel what you didn't write.\n"); return FALSE; } *************** *** 613,619 fprintf(ofp, "Can't cancel what you didn't write.\n"); return FALSE; } ! if (!cancel(ofp, hptr, 0) && hptr == h) { clear(bit); saveart; nextbit(); --- 616,622 ----- fprintf(ofp, "Can't cancel what you didn't write.\n"); return FALSE; } ! if (!cancel(ofp, hptr, notauthor) && hptr == h) { clear(bit); saveart; nextbit();