commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procgui.c procrun.c procrun.h procrun.rc
Date Sat, 03 May 2003 08:52:02 GMT
mturk       2003/05/03 01:52:02

  Modified:    daemon/src/native/nt/procrun procgui.c procrun.c procrun.h
                        procrun.rc
  Log:
  Add the User and Password edit boxes.
  They are used to launch the Tomcat under different user account.
  The service launch account and Tomcat account can be different.
  The user need to have 'Log on As Service' priviledge.
  
  Revision  Changes    Path
  1.16      +20 -2     jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c
  
  Index: procgui.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procgui.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- procgui.c	2 May 2003 20:41:37 -0000	1.15
  +++ procgui.c	3 May 2003 08:52:02 -0000	1.16
  @@ -466,8 +466,6 @@
              ac_center_window(hdlg);
              ac_splist_hwnd = GetDlgItem(hdlg, IDL_INFO); 
              break;
  -        default:
  -            return FALSE;
       }
   
       return FALSE;
  @@ -565,6 +563,8 @@
               SetDlgItemText(hdlg, RC_TXT_SD, g_env->m->service.description);
               SetDlgItemText(hdlg, RC_TXT_IP, g_env->m->service.image);
               SetDlgItemText(hdlg, RC_TXT_WP, g_env->m->service.path);
  +            SetDlgItemText(hdlg, RC_TXT_UN, g_env->m->service.account);
  +            SetDlgItemText(hdlg, RC_TXT_UP, g_env->m->service.password);
               if (g_env->m->service.startup == SERVICE_AUTO_START)
                   CheckDlgButton(hdlg, RC_CHK_AUTO, BST_CHECKED);
   
  @@ -591,6 +591,24 @@
                       argc = 2;
                       argv[argc++] = "--" PROCRUN_PARAMS_WORKPATH;
                       argv[argc++] = &txt[0];
  +                    procrun_update_service(&p, argc, argv);
  +                }
  +                if (GetDlgItemText(hdlg, RC_TXT_UN, txt, 64) > 0) {
  +                    argc = 2;
  +                    argv[argc++] = "--" PROCRUN_PARAMS_ACCOUNT;
  +                    argv[argc++] = &txt[0];
  +                    if (GetDlgItemText(hdlg, RC_TXT_UP, &txt[128], 64) > 0) {
  +                        argv[argc++] = "--" PROCRUN_PARAMS_PASSWORD;
  +                        argv[argc++] = &txt[128];
  +                        procrun_update_service(&p, argc, argv);
  +                    }
  +                }
  +                else if (g_env->m->service.account) {
  +                    argc = 2;
  +                    argv[argc++] = "--" PROCRUN_PARAMS_ACCOUNT;
  +                    argv[argc++] = "-";
  +                    argv[argc++] = "--" PROCRUN_PARAMS_PASSWORD;
  +                    argv[argc++] = "-";
                       procrun_update_service(&p, argc, argv);
                   }
                   /* TODO: check if the param is changed */
  
  
  
  1.19      +38 -10    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- procrun.c	1 May 2003 13:32:11 -0000	1.18
  +++ procrun.c	3 May 2003 08:52:02 -0000	1.19
  @@ -1556,9 +1556,10 @@
           program = env->m->java.jbin;
       }
       DBPRINTF2("RUN [%s] %s\n", program, env->m->argw);
  -    if (env->m->service.account && env->m->service.password &&
  -        env->m->service.mode == 1) {
  +    if (env->m->service.account && env->m->service.password) { // &&
  +//        env->m->service.mode == 1) {
           HANDLE user, token;
  +        DBPRINTF2("RUNASUSER %s@%s\n", env->m->service.account, env->m->service.password);
           if (!LogonUser(env->m->service.account, 
                          NULL, 
                          env->m->service.password, 
  @@ -1637,6 +1638,27 @@
       return 0;
   }
   
  +static int del_service_param(process_t *proc, const char *name)
  +{
  +    HKEY key;
  +    char skey[256];
  +    DWORD err, c;
  +
  +    sprintf(skey, PROCRUN_REGKEY_RPARAMS, proc->service.name);
  +    if ((err = RegCreateKeyEx(HKEY_LOCAL_MACHINE, skey, 0, NULL,
  +        0, KEY_ALL_ACCESS,
  +        NULL, &key, &c)) != ERROR_SUCCESS) {
  +        DBPRINTF0(NULL);
  +        DBPRINTF2("Failed Opening [%s] [%d]\n", skey, err);
  +        return -1;
  +    }
  +
  +    err = RegDeleteValue(key, name);
  +    RegCloseKey(key); 
  +    return (err != ERROR_SUCCESS);
  +
  +}
  +
   static int set_service_param(process_t *proc, const char *name,
                                const char *value, int len, int service)
   {
  @@ -1834,14 +1856,20 @@
       if (proc->java.stop_class)
           set_service_param(proc, PROCRUN_PARAMS_STOPCLASS,
                             proc->java.stop_class, 0, 0);
  -    if (proc->service.account)
  -        set_service_param(proc, PROCRUN_PARAMS_ACCOUNT,
  -                          proc->service.account, 0, 0);
  -    if (proc->service.password) {
  -        unsigned char b[256];
  -        simple_encrypt(100, proc->service.password, b);
  -        set_service_param(proc, PROCRUN_PARAMS_PASSWORD,
  -                          b, 256, 2);
  +    /* Account and password allways comes as pair */
  +    if (proc->service.account && proc->service.password) {
  +        if (*proc->service.account == '-') {
  +            del_service_param(proc, PROCRUN_PARAMS_ACCOUNT);
  +            del_service_param(proc, PROCRUN_PARAMS_PASSWORD);
  +        }
  +        else {
  +            unsigned char b[256];
  +            set_service_param(proc, PROCRUN_PARAMS_ACCOUNT,
  +                              proc->service.account, 0, 0);
  +            simple_encrypt(100, proc->service.password, b);
  +            set_service_param(proc, PROCRUN_PARAMS_PASSWORD,
  +                              b, 256, 2);
  +        }
       }
       if (proc->service.startup)
           set_service_param(proc, PROCRUN_PARAMS_STARTUP,
  
  
  
  1.17      +5 -0      jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h
  
  Index: procrun.h
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- procrun.h	1 May 2003 13:32:11 -0000	1.16
  +++ procrun.h	3 May 2003 08:52:02 -0000	1.17
  @@ -104,6 +104,7 @@
   
   #define IDM_OPTIONS           125
   #define RC_DLG_SRVOPT         130
  +#define RC_LBL_VER            131
   
   #define RC_TAB_SRVOPT        1000
   #define RC_GRP_MSP           1001
  @@ -119,6 +120,10 @@
   #define RC_TXT_WP            1011
   #define RC_BTN_BWP           1012
   #define RC_CHK_AUTO          1013
  +#define RC_LBL_UN            1014
  +#define RC_TXT_UN            1015
  +#define RC_LBL_UP            1016
  +#define RC_TXT_UP            1017
   #define RC_DLG_JVMOPT        1999
   #define RC_GRP_JVMOPT        2000
   #define RC_LBL_JVM           2001
  
  
  
  1.10      +9 -3      jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.rc
  
  Index: procrun.rc
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.rc,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- procrun.rc	28 Apr 2003 17:26:25 -0000	1.9
  +++ procrun.rc	3 May 2003 08:52:02 -0000	1.10
  @@ -87,7 +87,7 @@
   BEGIN
       POPUP "&Process"
       BEGIN
  -        MENUITEM "E&xit",                       IDM_MENU_EXIT
  +        MENUITEM "&Shutdown",                   IDM_MENU_EXIT
       END
       POPUP "&Edit"
       BEGIN
  @@ -116,23 +116,25 @@
   #ifdef _MSC_VER
   IDD_ABOUTBOX DIALOGEX 0, 0, 337, 167
   STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
  -CAPTION "About"
  +CAPTION "About Apache Process Runner"
   FONT 8, "Microsoft Sans Serif", 400, 0, 0x0
   BEGIN
       DEFPUSHBUTTON   "&OK",IDOK,285,150,50,14
       CONTROL         "",IDC_RICHEDIT21,"RichEdit20A",ES_MULTILINE | 
                       ES_READONLY | WS_BORDER | WS_VSCROLL,0,31,335,115
       CONTROL         117,IDC_STATIC,"Static",SS_BITMAP,0,0,337,30
  +    LTEXT           "Apache Process Runner ver. 1.0.0",IDC_STATIC,2,150,270,12
   END
   #else
   IDD_ABOUTBOX DIALOGEX 0, 0, 337, 167
   STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
  -CAPTION "About"
  +CAPTION "About Apache Process Runner"
   FONT 8, "Microsoft Sans Serif", 400, 0, 0x0
   BEGIN
       DEFPUSHBUTTON   "&OK",IDOK,285,150,50,14
       CONTROL         "",IDC_RICHEDIT21,"RichEdit20A",ES_MULTILINE | 
                       ES_READONLY | WS_BORDER | WS_VSCROLL,0,0,335,145
  +    LTEXT           "Apache Process Runner 1.0.0",IDC_STATIC,8,150,270,12
   END
   #endif
   
  @@ -166,6 +168,10 @@
       LTEXT           "Work path :",RC_LBL_WP,21,94,50,12
       EDITTEXT        RC_TXT_WP,75,92,219,12,ES_AUTOHSCROLL
       PUSHBUTTON      "...",RC_BTN_BWP,297,92,18,12
  +    LTEXT           "Username :",RC_LBL_UN,21,105,50,12
  +    EDITTEXT        RC_TXT_UN,75,105,108,12,ES_AUTOHSCROLL
  +    LTEXT           "Password :",RC_LBL_UP,21,118,50,12
  +    EDITTEXT        RC_TXT_UP,75,118,108,12,ES_PASSWORD | ES_AUTOHSCROLL
   END
   
   RC_DLG_JVMOPT DIALOGEX 0, 0, 337, 186
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message