Changeset 1435

Show
Ignore:
Timestamp:
05/18/08 10:41:13 (5 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1434 r1435  
    112008-05-17  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * admin/validations.py (is_local_file_exists) 
     4        (is_local_dir_exists), PageEntry.py, ModuleHtdigest.py, 
     5        PageAdvanced.py, ModulePlain.py, PageVServers.py, PageGeneral.py, 
     6        PageVServer.py, Form.py, ModuleHtpasswd.py: Added chroot support 
     7        to the local file/directory testing. This fix is kind of hacky: I 
     8        needed to import the "cfg" global in order to check whether the 
     9        server is jailed within a chroot. Anyway, even if it isn't clean, 
     10        it's a fairly acceptable solution. 
     11 
     12        * cherokee/main_tweak.c: Updated to use getopt_long(). The help 
     13        text has been rewritten as well. 
     14 
     15        * cherokee/Makefile.am (bin_PROGRAMS): "Cherokee tweak" binary 
     16        executable has changed from cherokee_tweak to cherokee-tweak. It 
     17        looked kind of weird with the underscore.  
     18 
     19        * cherokee/admin_client.c: Cleaned out. The internal phase 
     20        property was no needed. ->dowloader->status is enough to know in 
     21        this case. 
     22 
     23        * cherokee/downloader.c (cherokee_downloader_step): ->status set 
     24        and unset code rewritten to use BIT_SET and BIT_UNSET macros. It 
     25        is more readable now. 
    226 
    327        * cherokee/handler_proxy.c (cherokee_handler_proxy_add_headers): 
  • cherokee/trunk/admin/Form.py

    r1415 r1435  
    11import re 
     2import types 
    23 
    34from Entry import * 
     
    313314     
    314315    def ValidateChange_SingleKey (self, key, post, validation): 
    315         for regex, validation_func in validation: 
     316        for regex, tmp in validation: 
     317            pass_cfg = False 
     318 
     319            if type(tmp) == types.FunctionType: 
     320                validation_func = tmp 
     321 
     322            elif type(tmp) == types.TupleType: 
     323                validation_func = tmp[0] 
     324                for k in tmp[1:]: 
     325                    if k == 'cfg': 
     326                        pass_cfg = True 
     327                    else: 
     328                        print "UNKNOWN validation option:", k 
     329 
    316330            p = re.compile (regex) 
    317331            if p.match (key): 
     
    320334                    continue 
    321335                try: 
    322                     tmp = validation_func (value) 
     336                    if pass_cfg: 
     337                        tmp = validation_func (value, self._cfg) 
     338                    else: 
     339                        tmp = validation_func (value) 
    323340                    post[key] = [tmp] 
    324341                except ValueError, error: 
  • cherokee/trunk/admin/ModuleHtdigest.py

    r1419 r1435  
    55 
    66DATA_VALIDATION = [ 
    7     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile', validations.is_local_file_exists) 
     7    ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
     8     (validations.is_local_file_exists, 'cfg')) 
    89] 
    910 
  • cherokee/trunk/admin/ModuleHtpasswd.py

    r1419 r1435  
    55 
    66DATA_VALIDATION = [ 
    7     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile', validations.is_local_file_exists) 
     7    ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
     8     (validations.is_local_file_exists, 'cfg')) 
    89] 
    910 
  • cherokee/trunk/admin/ModulePlain.py

    r1419 r1435  
    55 
    66DATA_VALIDATION = [ 
    7     ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile', validations.is_local_file_exists) 
     7    ('vserver!.*?!(directory|extensions|request)!.*?!passwdfile',  
     8     (validations.is_local_file_exists, 'cfg')) 
    89] 
    910 
  • cherokee/trunk/admin/PageAdvanced.py

    r1394 r1435  
    1111    ("server!sendfile_min",           validations.is_positive_int), 
    1212    ("server!sendfile_max",           validations.is_positive_int), 
    13     ('server!panic_action',          validations.is_local_file_exists), 
     13    ('server!panic_action',          (validations.is_local_file_exists, 'cfg')), 
    1414    ('server!listen_queue',           validations.is_positive_int), 
    1515    ('server!max_connection_reuse',   validations.is_positive_int), 
  • cherokee/trunk/admin/PageEntry.py

    r1419 r1435  
    1616 
    1717DATA_VALIDATION = [ 
    18     ("vserver!.*?!(directory|extensions|request)!.*?!document_root", validations.is_local_dir_exists), 
    19     ("vserver!.*?!(directory|extensions|request)!.*?!allow_from",    validations.is_ip_or_netmask_list) 
     18    ("vserver!.*?!(directory|extensions|request)!.*?!document_root",  
     19     (validations.is_local_dir_exists, 'cfg')), 
     20    ("vserver!.*?!(directory|extensions|request)!.*?!allow_from", 
     21     validations.is_ip_or_netmask_list) 
    2022] 
    2123 
  • cherokee/trunk/admin/PageGeneral.py

    r1420 r1435  
    2020    ("server!port.*",    validations.is_tcp_port), 
    2121    ("server!listen",    validations.is_ip), 
    22     ("server!chroot",    validations.is_local_dir_exists), 
     22    ("server!chroot",   (validations.is_local_dir_exists, 'cfg')), 
    2323] 
    2424 
  • cherokee/trunk/admin/PageVServer.py

    r1432 r1435  
    99 
    1010DATA_VALIDATION = [ 
    11     ("vserver!.*?!document_root",                  validations.is_local_dir_exists), 
    12     ("vserver!.*?!ssl_certificate_file",           validations.is_local_file_exists), 
    13     ("vserver!.*?!ssl_certificate_key_file",       validations.is_local_file_exists), 
    14     ("vserver!.*?!ssl_ca_list_file",               validations.is_local_file_exists), 
    15     ("vserver!.*?!logger!access!filename",         validations.parent_is_dir), 
    16     ("vserver!.*?!logger!error!filename",          validations.parent_is_dir), 
    17     ("vserver!.*?!logger!access!command",          validations.is_local_file_exists), 
    18     ("vserver!.*?!logger!error!command",           validations.is_local_file_exists), 
     11    ("vserver!.*?!document_root",             (validations.is_local_dir_exists, 'cfg')), 
     12    ("vserver!.*?!ssl_certificate_file",      (validations.is_local_file_exists, 'cfg')), 
     13    ("vserver!.*?!ssl_certificate_key_file",  (validations.is_local_file_exists, 'cfg')), 
     14    ("vserver!.*?!ssl_ca_list_file",          (validations.is_local_file_exists, 'cfg')), 
     15    ("vserver!.*?!logger!access!filename",    (validations.parent_is_dir, 'cfg')), 
     16    ("vserver!.*?!logger!error!filename",     (validations.parent_is_dir, 'cfg')), 
     17    ("vserver!.*?!logger!access!command",     (validations.is_local_file_exists, 'cfg')), 
     18    ("vserver!.*?!logger!error!command",      (validations.is_local_file_exists, 'cfg')), 
    1919] 
    2020 
  • cherokee/trunk/admin/PageVServers.py

    r1415 r1435  
    77 
    88DATA_VALIDATION = [ 
    9     ("new_vserver_name",  validations.is_safe_id), 
    10     ("new_vserver_droot", validations.is_local_dir_exists), 
     9    ("new_vserver_name",  validations.is_safe_id), 
     10    ("new_vserver_droot", (validations.is_local_dir_exists, 'cfg')), 
    1111] 
    1212 
  • cherokee/trunk/admin/server.py

    r1326 r1435  
    4646    def handle_request (self): 
    4747        global cfg 
    48  
     48         
    4949        page    = None 
    5050        headers = "" 
     
    165165    srv.server_close() 
    166166 
    167  
    168167if __name__ == '__main__': 
    169168    main() 
  • cherokee/trunk/admin/validations.py

    r1400 r1435  
    8787    return value 
    8888     
    89 def is_local_dir_exists (value): 
     89def is_local_dir_exists (value, cfg): 
    9090    value = is_path (value) 
    9191 
    92     if not os.path.exists(value): 
     92    chroot = cfg.get_val('server!chroot') 
     93    if chroot: 
     94        path = os.path.normpath (chroot + os.path.sep + value) 
     95    else: 
     96        path = value 
     97 
     98    if not os.path.exists(path): 
    9399        raise ValueError, 'Path does not exits' 
    94100 
    95     if not os.path.isdir(value): 
     101    if not os.path.isdir(path): 
    96102        raise ValueError, 'Path is not a directory' 
    97103 
    98104    return value 
    99105 
    100 def is_local_file_exists (value): 
     106def is_local_file_exists (value, cfg): 
    101107    value = is_path (value) 
    102108 
    103     if not os.path.exists(value): 
     109    chroot = cfg.get_val('server!chroot') 
     110    if chroot: 
     111        path = os.path.normpath (chroot + os.path.sep + value) 
     112    else: 
     113        path = value 
     114 
     115    if not os.path.exists(path): 
    104116        raise ValueError, 'Path does not exits' 
    105117 
    106     if not os.path.isfile(value): 
     118    if not os.path.isfile(path): 
    107119        raise ValueError, 'Path is not a regular file' 
    108120 
    109121    return value 
    110122 
    111 def parent_is_dir (value): 
     123def parent_is_dir (value, cfg): 
    112124    value = is_path (value) 
    113125 
    114126    dirname, filename = os.path.split(value) 
    115     is_local_dir_exists (dirname
     127    is_local_dir_exists (dirname, cfg
    116128 
    117129    return value 
  • cherokee/trunk/cherokee/Makefile.am

    r1430 r1435  
    11471147# Log rotate utility 
    11481148# 
    1149 bin_PROGRAMS = cherokee_tweak 
     1149bin_PROGRAMS = cherokee-tweak 
    11501150 
    11511151cherokee_tweak_SOURCES = main_tweak.c 
  • cherokee/trunk/cherokee/admin_client.c

    r1131 r1435  
    3636 
    3737 
    38 typedef enum { 
    39         admin_phase_init, 
    40         admin_phase_stepping, 
    41         admin_phase_finished 
    42 } admin_phase_t; 
    43  
    44  
    4538struct cherokee_admin_client { 
    4639        cherokee_downloader_async_t *downloader; 
     
    5144 
    5245        cherokee_post_t              post; 
    53         admin_phase_t                phase; 
    5446        cherokee_fdpoll_t           *poll_ref; 
    5547}; 
     
    6658        /* Init 
    6759         */ 
    68         n->phase        = admin_phase_init; 
    69  
    70         n->poll_ref     = NULL; 
    71         n->url_ref      = NULL; 
     60        n->poll_ref = NULL; 
     61        n->url_ref  = NULL; 
    7262 
    7363        cherokee_post_init (&n->post); 
     
    9282 
    9383        free (admin); 
    94         return ret_ok; 
    95 } 
    96  
    97  
    98 static ret_t 
    99 on_downloader_finish (void *_downloader, void *_param) 
    100 { 
    101         cherokee_admin_client_t *admin = _param; 
    102  
    103         admin->phase = admin_phase_finished; 
    10484        return ret_ok; 
    10585} 
     
    11595        ret_t                  ret; 
    11696        cherokee_downloader_t *downloader = DOWNLOADER(admin->downloader); 
    117  
    118         admin->phase    = admin_phase_init; 
    11997 
    12098        admin->poll_ref = poll; 
     
    134112        /* Set up the downloader object properties 
    135113         */ 
    136         ret = cherokee_downloader_async_set_fdpoll (downloader, admin->poll_ref); 
     114        ret = cherokee_downloader_async_set_fdpoll (DOWNLOADER_ASYNC(downloader), admin->poll_ref); 
    137115        if (unlikely (ret != ret_ok)) return ret; 
    138116         
     
    148126        if (unlikely (ret != ret_ok)) return ret;        
    149127 
    150 #warning "Fix this!" 
    151 /*      ret = cherokee_downloader_connect_event (downloader, downloader_event_finish, on_downloader_finish, admin); */ 
    152 /*      if (unlikely (ret != ret_ok)) return ret; */ 
    153  
    154128        TRACE(ENTRIES, "Exists obj=%p\n", admin); 
    155129        return ret_ok; 
     
    177151        cherokee_buffer_clean (&admin->reply); 
    178152 
    179         admin->phase = admin_phase_init; 
    180         return ret_ok; 
    181 
    182  
    183  
    184 ret_t 
    185 cherokee_admin_client_internal_step (cherokee_admin_client_t *admin) 
    186 
    187         ret_t ret; 
    188  
    189         TRACE(ENTRIES, "Enters phase=%d\n", admin->phase); 
    190  
    191         /* Has it finished? 
    192          */ 
    193         if (admin->phase == admin_phase_finished)  
    194                 return ret_ok; 
    195  
    196         /* Sanity check 
    197          */ 
    198         if (admin->phase != admin_phase_stepping)  
    199                 return ret_error; 
     153        return ret_ok; 
     154
     155 
     156 
     157static ret_t 
     158internal_step (cherokee_admin_client_t *admin) 
     159
     160        ret_t                  ret; 
     161        cherokee_downloader_t *downloader = DOWNLOADER(admin->downloader); 
     162 
     163        TRACE(ENTRIES, "Downloader phase=%d\n", downloader->phase); 
    200164 
    201165        /* It's stepping 
     
    233197        cherokee_post_append (&admin->post, str, str_len); 
    234198        cherokee_downloader_post_set (downloader, &admin->post);  
    235  
    236         admin->phase = admin_phase_stepping; 
    237199} 
    238200 
     
    279241                   void *argument)  
    280242{ 
    281         ret_t ret; 
    282  
    283         TRACE(ENTRIES, "phase %d\n", admin->phase); 
    284  
    285         switch (admin->phase) { 
    286         case admin_phase_init: 
     243        ret_t                  ret; 
     244        cherokee_downloader_t *downloader = DOWNLOADER(admin->downloader); 
     245 
     246        TRACE(ENTRIES, "Downloader phase: %d\n", downloader->phase); 
     247 
     248        /* Initial state: needs to get the Post info 
     249         */ 
     250        if ((downloader->phase == downloader_phase_init) && 
     251            (downloader->post == NULL)) 
     252        { 
    287253                conf_request_func (admin, argument); 
    288254                return ret_eagain; 
    289         case admin_phase_stepping: 
    290                 ret = cherokee_admin_client_internal_step (admin); 
    291                 return ret; 
    292         case admin_phase_finished: 
     255        } 
     256 
     257        /* Finished  
     258         */ 
     259        if (downloader->phase == downloader_phase_finished) 
    293260                return ret_ok; 
    294         default: 
    295                SHOULDNT_HAPPEN; 
    296         } 
    297  
    298         return ret_error
     261 
     262        /* It's iterating 
     263        */ 
     264        ret = internal_step (admin); 
     265        return ret
    299266} 
    300267 
  • cherokee/trunk/cherokee/admin_client.h

    r1131 r1435  
    8080 
    8181 
    82 ret_t cherokee_admin_client_new      (cherokee_admin_client_t **admin); 
    83 ret_t cherokee_admin_client_free     (cherokee_admin_client_t  *admin); 
     82ret_t cherokee_admin_client_new             (cherokee_admin_client_t **admin); 
     83ret_t cherokee_admin_client_free            (cherokee_admin_client_t  *admin); 
    8484 
    85 ret_t cherokee_admin_client_prepare        (cherokee_admin_client_t *admin, cherokee_fdpoll_t *poll, cherokee_buffer_t *url, cherokee_buffer_t *user, cherokee_buffer_t *pass); 
    86 ret_t cherokee_admin_client_connect        (cherokee_admin_client_t *admin); 
    87 ret_t cherokee_admin_client_reuse          (cherokee_admin_client_t *admin); 
    88 ret_t cherokee_admin_client_internal_step  (cherokee_admin_client_t *admin); 
    89 ret_t cherokee_admin_client_get_reply_code (cherokee_admin_client_t *admin, cherokee_http_t *code); 
     85ret_t cherokee_admin_client_prepare         (cherokee_admin_client_t *admin, cherokee_fdpoll_t *poll, cherokee_buffer_t *url, cherokee_buffer_t *user, cherokee_buffer_t *pass); 
     86ret_t cherokee_admin_client_connect         (cherokee_admin_client_t *admin); 
     87ret_t cherokee_admin_client_reuse           (cherokee_admin_client_t *admin); 
     88ret_t cherokee_admin_client_get_reply_code  (cherokee_admin_client_t *admin, cherokee_http_t *code); 
    9089 
    9190/* Retrieve information methods 
  • cherokee/trunk/cherokee/downloader.c

    r1433 r1435  
    469469                if (unlikely(ret != ret_ok)) return ret; 
    470470 
    471                 downloader->status = downloader_status_headers_sent
     471                BIT_SET (downloader->status, downloader_status_headers_sent)
    472472                downloader->phase = downloader_phase_send_post; 
    473473 
     
    482482                } 
    483483 
    484                 downloader->status = downloader->status | downloader_status_post_sent
     484                BIT_SET (downloader->status, downloader_status_post_sent)
    485485                downloader->phase = downloader_phase_read_headers; 
    486486                break; 
     
    494494                /* We have the header parsed, continue.. 
    495495                 */ 
    496                 downloader->status = downloader->status | downloader_status_headers_received
     496                BIT_SET (downloader->status, downloader_status_headers_received)
    497497                downloader->phase = downloader_phase_step; 
    498498 
     
    500500                 */ 
    501501                if (downloader->info.body_recv >= downloader->content_length) { 
    502                         downloader->status = downloader->status | downloader_status_data_available | downloader_status_finished; 
     502                        BIT_SET (downloader->status, downloader_status_data_available); 
     503                        BIT_SET (downloader->status, downloader_status_finished); 
    503504                        return ret_eof_have_data; 
    504505                } 
     
    512513                        break; 
    513514                case ret_ok: 
    514                         downloader->status = downloader->status | downloader_status_data_available
     515                        BIT_SET (downloader->status, downloader_status_data_available)
    515516                        break; 
    516517                case ret_eof_have_data: 
    517                         downloader->status = downloader->status | downloader_status_data_available | downloader_status_finished; 
     518                        BIT_SET (downloader->status, downloader_status_data_available); 
     519                        BIT_SET (downloader->status, downloader_status_finished); 
    518520                        break; 
    519521                case ret_eof: 
    520                         downloader->status = downloader->status & (~downloader_status_data_available | downloader_status_finished); 
     522                        BIT_UNSET (downloader->status, downloader_status_data_available); 
     523                        BIT_SET   (downloader->status, downloader_status_finished); 
    521524                        break; 
    522525                case ret_eagain: 
    523                         downloader->status = downloader->status & ~downloader_status_data_available
     526                        BIT_UNSET (downloader->status, downloader_status_data_available)
    524527                        break; 
    525528                default: 
     
    531534                TRACE(ENTRIES, "Phase %s\n", "finished"); 
    532535 
    533                 downloader->status = downloader->status & ~downloader_status_data_available & downloader_status_finished; 
     536                BIT_SET   (downloader->status, downloader_status_finished); 
     537                BIT_UNSET (downloader->status, downloader_status_data_available); 
    534538                return ret_ok; 
    535539 
  • cherokee/trunk/cherokee/downloader_async.c

    r1131 r1435  
    107107        int                    re; 
    108108        int                    fd; 
    109         int                    rw     = FDPOLL_MODE_READ
     109        int                    rw
    110110        cherokee_downloader_t *down   = DOWNLOADER(adownloader); 
    111111        cherokee_fdpoll_t     *fdpoll = adownloader->fdpoll_ref; 
    112112 
    113113        TRACE(ENTRIES, "Enters obj=%p fdpoll=%p\n", adownloader, fdpoll); 
    114  
    115         if (fdpoll == NULL) 
    116                 return ret_error; 
     114        return_if_fail ((fdpoll != NULL), ret_error); 
    117115 
    118116        /* Watch the fd poll 
     
    127125        if (down->phase <= downloader_phase_send_post)  
    128126                rw = FDPOLL_MODE_WRITE; 
     127        else 
     128                rw = FDPOLL_MODE_READ; 
    129129 
    130130        TRACE(ENTRIES, "rw = %d\n", rw); 
     
    133133         */ 
    134134        fd = down->socket.socket; 
    135  
    136135        re = cherokee_fdpoll_check (fdpoll, fd, rw); 
    137136        switch (re) { 
  • cherokee/trunk/cherokee/macros.h

    r1359 r1435  
    333333/* Bit masks 
    334334 */ 
    335 #define BIT_SET(var,bit)    var |= bit 
     335#define BIT_SET(var,bit)    var |= (bit) 
    336336#define BIT_UNSET(var,bit)  var &= ~(bit) 
    337337 
  • cherokee/trunk/cherokee/main_tweak.c

    r1355 r1435  
    3333#include <cherokee/cherokee.h> 
    3434 
     35/* Notices  
     36 */ 
     37#define APP_NAME        \ 
     38        "Cherokee Web Server: Tweaker" 
     39 
     40#define APP_COPY_NOTICE \ 
     41        "Written by Alvaro Lopez Ortega <alvaro@gnu.org>\n\n"                          \ 
     42        "Copyright (C) 2001-2008 Alvaro Lopez Ortega.\n"                               \ 
     43        "This is free software; see the source for copying conditions.  There is NO\n" \ 
     44        "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" 
     45 
     46 
    3547#define EXIT_OK     0 
    3648#define EXIT_ERROR  1 
     
    5870print_help (void) 
    5971{ 
    60         printf ("Cherokee Tweak\n" 
    61                 "Usage: cherokee_tweak -c command -u url [options]\n\n" 
    62                 "  -h                   Print this help\n" 
    63                 "  -V                   Print version and exit\n\n" 
     72        printf (APP_NAME "\n" 
     73                "Usage: cherokee-tweak -c command -u url [options]\n\n" 
     74                "  -h,  --help                   Print this help\n" 
     75                "  -V,  --version                Print version and exit\n\n" 
     76                " Required:\n" 
     77                "  -c,  --command=STRING         Command: logrotate, trace, info\n" 
     78                "  -a,  --url=URL                URL to the admin interface\n\n" 
    6479                " Secutiry:\n" 
    65                 "  -u STRING            User name\n" 
    66                 "  -p STRING            Password\n\n" 
    67                 " Required:\n" 
    68                 "  -c STRING            Command: logrotate, trace, info\n" 
    69                 "  -a URL               URL to the admin interface\n\n" 
     80                "  -u,  --user=STRING            User name\n" 
     81                "  -p,  --password=STRING        Password\n\n" 
    7082                " Logrotate:\n" 
    71                 "  -l PATH              Log file to be rotated\n\n" 
     83                "  -l,  --log=PATH               Log file to be rotated\n\n" 
    7284                " Trace:\n" 
    73                 "  -t STRING            Modules to be traced\n" 
    74                 "\n" 
    75                 "Report bugs to cherokee@cherokee-project.org\n"); 
     85                "  -t,  --trace=STRING           Modules to be traced\n\n" 
     86                "Report bugs to " PACKAGE_BUGREPORT "\n"); 
    7687} 
    7788 
     
    7990print_usage (void) 
    8091{ 
    81         printf ("Cherokee Tweak\n" 
    82                 "Usage: cherokee_tweak -c command -u url [options]\n\n" 
    83                 "Try `cherokee_tweak --help' for more options.\n"); 
     92        printf (APP_NAME "\n" 
     93                "Usage: cherokee-tweak -c command -u url [options]\n\n" 
     94                "Try `cherokee-tweak --help' for more options.\n"); 
    8495} 
    8596 
     
    357368        cherokee_buffer_t  password = CHEROKEE_BUF_INIT; 
    358369 
     370        struct option long_options[] = { 
     371                {"help",         no_argument,       NULL, 'h'}, 
     372                {"version",      no_argument,       NULL, 'V'}, 
     373                {"command",      required_argument, NULL, 'c'}, 
     374                {"url",          required_argument, NULL, 'a'}, 
     375                {"user",         required_argument, NULL, 'u'}, 
     376                {"password",     required_argument, NULL, 'p'}, 
     377                {"log",          required_argument, NULL, 'l'}, 
     378                {"trace",        required_argument, NULL, 't'}, 
     379                {NULL, 0, NULL, 0} 
     380        }; 
     381 
     382        /* Initialize the library 
     383         */ 
    359384        cherokee_init(); 
    360385        TRACE(ENTRIES, "Starts %d args\n", argc-1); 
    361          
     386 
    362387        /* Parse the parameters 
    363388         */ 
    364        while ((c = getopt(argc, argv, GETOPT_OPT)) != -1) { 
     389       while ((c = getopt_long(argc, argv, "hVc:a:u:p:l:t:", long_options, NULL)) != -1) { 
    365390                switch(c) { 
    366                 case 'V': 
    367                         printf ("Cherokee Web Server %s\n" 
    368                                 "Copyright (C) 2001-2008 Alvaro Lopez Ortega <alvaro@gnu.org>.\n\n" 
    369                                 "This is free software; see the source for copying conditions.  There is NO\n" 
    370                                 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n", 
    371                                 PACKAGE_VERSION); 
    372                         exit(0); 
    373391                case 'u': 
    374392                        cherokee_buffer_add (&user, optarg, strlen(optarg)); 
     
    389407                        cherokee_buffer_add (&log, optarg, strlen(optarg)); 
    390408                        break; 
     409                case 'V': 
     410                        printf (APP_NAME " " PACKAGE_VERSION "\n" APP_COPY_NOTICE); 
     411                        exit (EXIT_OK); 
    391412                case 'h': 
    392413                case '?':