Annotation of 41BSD/cmd/uucp/uusecure.c, revision 1.1.1.1

1.1       root        1: #include "uucp.h"
                      2: #include "sgtty.h"
                      3: #include "uucpdefs.h"
                      4: #include "signal.h"
                      5: #include ".secret"
                      6: #define SEP '\t'
                      7: #define MAXC 300
                      8: 
                      9: /*******
                     10:  * this program reads a file whose format is
                     11:  *     field1 SEP count field2
                     12:  *   and runs crypt on field2.  Count is either blank (read to newline)
                     13:  *   or SEP followed by a count byte.
                     14:  */
                     15: 
                     16: main (argc,argv)
                     17: char *argv[];
                     18: {
                     19:        char str[10];
                     20:        char tl[MAXC], tr[MAXC], enc[MAXC];
                     21:        int count, i, ln, clear;
                     22:        FILE *fp1, *fp2;
                     23:        struct sgttyb sb;
                     24:        extern intrEXIT();
                     25: 
                     26:        signal(SIGQUIT, intrEXIT);
                     27:        signal(SIGILL, intrEXIT);
                     28:        signal(SIGTRAP, intrEXIT);
                     29:        signal(SIGIOT, intrEXIT);
                     30:        signal(SIGEMT, intrEXIT);
                     31:        signal(SIGFPE, intrEXIT);
                     32:        signal(SIGBUS, intrEXIT);
                     33:        signal(SIGSEGV, intrEXIT);
                     34:        signal(SIGSYS, intrEXIT);
                     35:        if (argc < 3)
                     36:                exit(100);
                     37:        fp1 = fopen(argv[1], "r");
                     38:        fp2 = fopen(argv[2], "w");
                     39:        if (fp1 == NULL || fp2 == NULL)
                     40:                exit(120);
                     41:        gtty(0, &sb);
                     42:        sb.sg_flags &= ~ECHO;
                     43:        stty(0, &sb);
                     44:        printf("Passwd:");
                     45:        gets(str);
                     46:        sb.sg_flags |= ECHO;
                     47:        stty(0, &sb);
                     48:        strcpy(tl, secret);
                     49:        hdpw(str);
                     50:        for (ln = 0;; ln++) {
                     51:                if (gleft(tl, fp1) == 0) {
                     52:                        fclose(fp1);
                     53:                        fclose(fp2);
                     54:                        exit(0);
                     55:                }
                     56:                ASSERT(strlen(tl) < MAXC, "LEFT PART LONG %s", tl);
                     57:                count = gright(tr, fp1, &clear);
                     58:                ASSERT(count < MAXC, "RIGHT LONG %s", tr);
                     59:                encrypt(tr, enc, ln, count);
                     60:                fprintf(fp2, "%s%c", tl, SEP);
                     61:                if (clear)
                     62:                        fprintf(fp2, "%c%c", SEP, count);
                     63:                for(i = 0; i < count; i++)
                     64:                        putc(enc[i], fp2);
                     65:                putc('\n', fp2);
                     66:        }
                     67: }
                     68: 
                     69: 
                     70: /***
                     71:  *     rmlock(p)       this is a dummy called in ASSERT
                     72:  */
                     73: rmlock(p)
                     74: char *p;
                     75: {
                     76:        return;
                     77: }
                     78: cleanup(code)
                     79: int code;
                     80: {
                     81:        exit(code);
                     82: }
                     83: 
                     84: intrEXIT() {_exit(77);}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.