home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / unaxcess / part1 / Utilities / mkconf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  1.2 KB  |  57 lines

  1. /*
  2.  * %W% %E% %U% ncoast!bsa %Z%
  3.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  4.  */
  5.  
  6. #ifndef lint
  7. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  8. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  9. #endif  lint
  10.  
  11. /* this version that execs "mkdir" by jpn 4/12/86 */
  12. main(argc, argv)
  13. int argc;
  14. char **argv;
  15.     {
  16.     setuid(geteuid());
  17.     umask(022);
  18.     execvp("mkdir", argv);
  19.     }
  20.  
  21. #if 0
  22. /* I considered the original supplied version to be too dangerous and
  23. ** actually quite unnecessary.  This program just does a "mkdir", so
  24. ** the my version just exec's "mkdir"!
  25. **
  26. ** I HATE having setuid to root programs on my system that were not supplied
  27. ** as part of the system!                 - jpn 4/12/86
  28. */
  29. #include <sys/types.h>
  30. #include <sys/stat.h>
  31. #include <sys/dir.h>
  32.  
  33. char line[256];
  34.  
  35. #ifdef SYS3
  36. #define RIndex        strrchr
  37. #else
  38. #define RIndex        rindex
  39. #endif SYS3
  40.  
  41. char *RIndex();
  42.  
  43. main(argc, argv)
  44.     char **argv;
  45.     {
  46.     if (argc != 3)
  47.     exit(1);
  48.     mknod(argv[1], S_IFDIR|0755, 0);
  49.     chown(argv[1], atoi(argv[2]), 50);
  50.     sprintf(line, "%s/.", argv[1]);
  51.     link(argv[1], line);
  52.     *RIndex(argv[1], '/') = '\0';
  53.     strcat(line, ".");
  54.     link(argv[1], line);
  55.     }
  56. #endif
  57.