Changeset 171 for branches/samba-3.0
- Timestamp:
- Apr 14, 2009, 4:33:28 PM (17 years ago)
- File:
-
- 1 edited
-
branches/samba-3.0/source/web/startstop.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/web/startstop.c
r1 r171 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 21 20 #include "includes.h" 21 22 23 24 25 26 27 28 29 30 31 22 32 #include "web/swat_proto.h" 23 33 #include "dynconfig.h" 24 25 34 26 35 /** Startup smbd from web interface. */ … … 28 37 { 29 38 pstring binfile; 30 31 39 if (geteuid() != 0) return; 32 40 41 42 43 33 44 if (fork()) { 34 45 return; 35 46 } 36 37 47 slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR); 38 39 48 become_daemon(True, False); 40 41 49 execl(binfile, binfile, "-D", NULL); 42 43 50 exit(0); 51 44 52 } 45 46 53 /* startup nmbd */ 47 54 void start_nmbd(void) 48 55 { 49 56 pstring binfile; 50 51 57 if (geteuid() != 0) return; 52 58 59 60 61 53 62 if (fork()) { 54 63 return; 55 64 } 56 57 65 slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR); 58 66 59 67 become_daemon(True, False); 60 61 68 execl(binfile, binfile, "-D", NULL); 62 63 69 exit(0); 70 64 71 } 65 66 72 /** Startup winbindd from web interface. */ 67 73 void start_winbindd(void) … … 71 77 if (geteuid() != 0) return; 72 78 79 80 81 82 73 83 if (fork()) { 74 84 return; 75 85 } 76 77 86 slprintf(binfile, sizeof(pstring) - 1, "%s/winbindd", dyn_SBINDIR); 78 79 87 become_daemon(True, False); 80 81 88 execl(binfile, binfile, NULL); 82 83 89 exit(0); 90 84 91 } 85 86 92 87 93 /* stop smbd */ … … 89 95 { 90 96 pid_t pid = pidfile_pid("smbd"); 91 92 97 if (geteuid() != 0) return; 93 98 99 100 101 102 103 104 94 105 if (pid <= 0) return; 95 106 96 107 kill(pid, SIGTERM); 108 97 109 } 98 99 110 /* stop nmbd */ 100 111 void stop_nmbd(void) 101 112 { 102 113 pid_t pid = pidfile_pid("nmbd"); 114 103 115 104 if (geteuid() != 0) return; 105 116 #ifdef __OS2__ /* we do it a bit nicer */ 117 if (nmbd_running()) { 118 pstring binfile; 119 SWAT_HELPER(stop, nmbd) 120 } 121 #else 106 122 if (pid <= 0) return; 107 123 108 124 kill(pid, SIGTERM); 125 109 126 } 127 110 128 #ifdef WITH_WINBIND 111 129 /* stop winbindd */ … … 116 134 if (geteuid() != 0) return; 117 135 136 137 138 139 140 141 118 142 if (pid <= 0) return; 119 143 120 144 kill(pid, SIGTERM); 145 121 146 } 122 147 #endif … … 125 150 { 126 151 if (geteuid() != 0) return; 127 128 if (procid_to_pid(&pid) <= 0) return;152 153 if (procid_to_pid(&pid) <= 0) return; 129 154 130 155 kill(procid_to_pid(&pid), SIGTERM);
Note:
See TracChangeset
for help on using the changeset viewer.
