Changeset 171 for branches/samba-3.0


Ignore:
Timestamp:
Apr 14, 2009, 4:33:28 PM (17 years ago)
Author:
Herwig Bauernfeind
Message:

Fix for Ticket #53 and #54

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/web/startstop.c

    r1 r171  
    1818   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    1919*/
    20 
    2120#include "includes.h"
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
    2232#include "web/swat_proto.h"
    2333#include "dynconfig.h"
    24 
    2534
    2635/** Startup smbd from web interface. */
     
    2837{
    2938        pstring binfile;
    30 
    3139        if (geteuid() != 0) return;
    3240
     41
     42
     43
    3344        if (fork()) {
    3445                return;
    3546        }
    36 
    3747        slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR);
    38 
    3948        become_daemon(True, False);
    40 
    4149        execl(binfile, binfile, "-D", NULL);
    42 
    4350        exit(0);
     51
    4452}
    45 
    4653/* startup nmbd */
    4754void start_nmbd(void)
    4855{
    4956        pstring binfile;
    50 
    5157        if (geteuid() != 0) return;
    5258
     59
     60
     61
    5362        if (fork()) {
    5463                return;
    5564        }
    56 
    5765        slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR);
    5866       
    5967        become_daemon(True, False);
    60 
    6168        execl(binfile, binfile, "-D", NULL);
    62 
    6369        exit(0);
     70
    6471}
    65 
    6672/** Startup winbindd from web interface. */
    6773void start_winbindd(void)
     
    7177        if (geteuid() != 0) return;
    7278
     79
     80
     81
     82
    7383        if (fork()) {
    7484                return;
    7585        }
    76 
    7786        slprintf(binfile, sizeof(pstring) - 1, "%s/winbindd", dyn_SBINDIR);
    78 
    7987        become_daemon(True, False);
    80 
    8188        execl(binfile, binfile, NULL);
    82 
    8389        exit(0);
     90
    8491}
    85 
    8692
    8793/* stop smbd */
     
    8995{
    9096        pid_t pid = pidfile_pid("smbd");
    91 
    9297        if (geteuid() != 0) return;
    9398
     99
     100
     101
     102
     103
     104
    94105        if (pid <= 0) return;
    95106
    96107        kill(pid, SIGTERM);
     108
    97109}
    98 
    99110/* stop nmbd */
    100111void stop_nmbd(void)
    101112{
    102113        pid_t pid = pidfile_pid("nmbd");
     114
    103115
    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
    106122        if (pid <= 0) return;
    107123
    108124        kill(pid, SIGTERM);
     125
    109126}
     127
    110128#ifdef WITH_WINBIND
    111129/* stop winbindd */
     
    116134        if (geteuid() != 0) return;
    117135
     136
     137
     138
     139
     140
     141
    118142        if (pid <= 0) return;
    119143
    120144        kill(pid, SIGTERM);
     145
    121146}
    122147#endif
     
    125150{
    126151        if (geteuid() != 0) return;
    127 
    128         if (procid_to_pid(&pid) <= 0) return;
     152 
     153if (procid_to_pid(&pid) <= 0) return;
    129154
    130155        kill(procid_to_pid(&pid), SIGTERM);
Note: See TracChangeset for help on using the changeset viewer.