rpc_parse/parse_svcctl.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  RPC Pipe client / server routines
00004  *  Copyright (C) Gerald (Jerry) Carter             2005.
00005  *  
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *  
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *  
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #include "includes.h"
00022 
00023 #undef DBGC_CLASS
00024 #define DBGC_CLASS DBGC_RPC_PARSE
00025 
00026 /*******************************************************************
00027 ********************************************************************/
00028 
00029 static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth )
00030 {
00031 
00032         prs_debug(ps, depth, desc, "svcctl_io_service_status");
00033         depth++;
00034 
00035         if(!prs_uint32("type", ps, depth, &status->type))
00036                 return False;
00037 
00038         if(!prs_uint32("state", ps, depth, &status->state))
00039                 return False;
00040 
00041         if(!prs_uint32("controls_accepted", ps, depth, &status->controls_accepted))
00042                 return False;
00043 
00044         if(!prs_werror("win32_exit_code", ps, depth, &status->win32_exit_code))
00045                 return False;
00046 
00047         if(!prs_uint32("service_exit_code", ps, depth, &status->service_exit_code))
00048                 return False;
00049 
00050         if(!prs_uint32("check_point", ps, depth, &status->check_point))
00051                 return False;
00052 
00053         if(!prs_uint32("wait_hint", ps, depth, &status->wait_hint))
00054                 return False;
00055 
00056         return True;
00057 }
00058 
00059 /*******************************************************************
00060 ********************************************************************/
00061 
00062 static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth )
00063 {
00064 
00065         prs_debug(ps, depth, desc, "svcctl_io_service_config");
00066         depth++;
00067 
00068         if(!prs_uint32("service_type", ps, depth, &config->service_type))
00069                 return False;
00070         if(!prs_uint32("start_type", ps, depth, &config->start_type))
00071                 return False;
00072         if(!prs_uint32("error_control", ps, depth, &config->error_control))
00073                 return False;
00074 
00075         if (!prs_io_unistr2_p("", ps, depth, &config->executablepath))
00076                 return False;
00077         if (!prs_io_unistr2_p("", ps, depth, &config->loadordergroup))
00078                 return False;
00079 
00080         if(!prs_uint32("tag_id", ps, depth, &config->tag_id))
00081                 return False;
00082 
00083         if (!prs_io_unistr2_p("", ps, depth, &config->dependencies))
00084                 return False;
00085         if (!prs_io_unistr2_p("", ps, depth, &config->startname))
00086                 return False;
00087         if (!prs_io_unistr2_p("", ps, depth, &config->displayname))
00088                 return False;
00089 
00090         if (!prs_io_unistr2("", ps, depth, config->executablepath))
00091                 return False;
00092         if (!prs_io_unistr2("", ps, depth, config->loadordergroup))
00093                 return False;
00094         if (!prs_io_unistr2("", ps, depth, config->dependencies))
00095                 return False;
00096         if (!prs_io_unistr2("", ps, depth, config->startname))
00097                 return False;
00098         if (!prs_io_unistr2("", ps, depth, config->displayname))
00099                 return False;
00100 
00101         return True;
00102 }
00103 
00104 /*******************************************************************
00105 ********************************************************************/
00106 
00107 BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth )
00108 {
00109         prs_struct *ps=&buffer->prs;
00110         
00111         prs_debug(ps, depth, desc, "svcctl_io_enum_services_status");
00112         depth++;
00113         
00114         if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) )
00115                 return False;
00116         if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) )
00117                 return False;
00118 
00119         if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) )
00120                 return False;
00121         
00122         return True;
00123 }
00124 
00125 /*******************************************************************
00126 ********************************************************************/
00127 
00128 BOOL svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth )
00129 {
00130         prs_struct *ps=&buffer->prs;
00131 
00132         prs_debug(ps, depth, desc, "svcctl_io_service_status_process");
00133         depth++;
00134 
00135         if ( !svcctl_io_service_status("status", &status->status, ps, depth) )
00136                 return False;
00137         if(!prs_align(ps))
00138                 return False;
00139 
00140         if(!prs_uint32("process_id", ps, depth, &status->process_id))
00141                 return False;
00142         if(!prs_uint32("service_flags", ps, depth, &status->service_flags))
00143                 return False;
00144 
00145         return True;
00146 }
00147 
00148 /*******************************************************************
00149 ********************************************************************/
00150 
00151 uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status )
00152 {
00153         uint32 size = 0;
00154         
00155         size += size_of_relative_string( &status->servicename );
00156         size += size_of_relative_string( &status->displayname );
00157         size += sizeof(SERVICE_STATUS);
00158 
00159         return size;
00160 }
00161 
00162 /********************************************************************
00163 ********************************************************************/
00164 
00165 static uint32 sizeof_unistr2( UNISTR2 *string )
00166 {
00167         uint32 size = 0;
00168 
00169         if ( !string ) 
00170                 return 0;       
00171 
00172         size  = sizeof(uint32) * 3;             /* length fields */
00173         size += 2 * string->uni_max_len;        /* string data */
00174         size += size % 4;                       /* alignment */
00175 
00176         return size;
00177 }
00178 
00179 /********************************************************************
00180 ********************************************************************/
00181 
00182 uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config )
00183 {
00184         uint32 size = 0;
00185 
00186         size = sizeof(uint32) * 4;      /* static uint32 fields */
00187 
00188         /* now add the UNISTR2 + pointer sizes */
00189 
00190         size += sizeof(uint32) * sizeof_unistr2(config->executablepath);
00191         size += sizeof(uint32) * sizeof_unistr2(config->loadordergroup);
00192         size += sizeof(uint32) * sizeof_unistr2(config->dependencies);
00193         size += sizeof(uint32) * sizeof_unistr2(config->startname);
00194         size += sizeof(uint32) * sizeof_unistr2(config->displayname);
00195         
00196         return size;
00197 }
00198 
00199 
00200 
00201 /*******************************************************************
00202 ********************************************************************/
00203 
00204 BOOL svcctl_io_q_close_service(const char *desc, SVCCTL_Q_CLOSE_SERVICE *q_u, prs_struct *ps, int depth)
00205 {
00206         
00207         if (q_u == NULL)
00208                 return False;
00209 
00210         prs_debug(ps, depth, desc, "svcctl_io_q_close_service");
00211         depth++;
00212 
00213         if(!prs_align(ps))
00214                 return False;
00215 
00216         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
00217                 return False;
00218 
00219         return True;
00220 }
00221 
00222 
00223 /*******************************************************************
00224 ********************************************************************/
00225 
00226 BOOL svcctl_io_r_close_service(const char *desc, SVCCTL_R_CLOSE_SERVICE *r_u, prs_struct *ps, int depth)
00227 {
00228         if (r_u == NULL)
00229                 return False;
00230 
00231         prs_debug(ps, depth, desc, "svcctl_io_r_close_service");
00232         depth++;
00233 
00234         if(!prs_align(ps))
00235             return False;
00236 
00237         if(!smb_io_pol_hnd("pol_handle", &r_u->handle, ps, depth))
00238            return False; 
00239 
00240         if(!prs_werror("status", ps, depth, &r_u->status))
00241                 return False;
00242 
00243         return True;
00244 }
00245 
00246 /*******************************************************************
00247 ********************************************************************/
00248 
00249 BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, prs_struct *ps, int depth)
00250 {
00251         if (q_u == NULL)
00252                 return False;
00253 
00254         prs_debug(ps, depth, desc, "svcctl_io_q_open_scmanager");
00255         depth++;
00256 
00257         if(!prs_align(ps))
00258                 return False;
00259 
00260         if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
00261                 return False;
00262         if(!prs_align(ps))
00263                 return False;
00264 
00265         if(!prs_pointer("database", ps, depth, (void*)&q_u->database, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
00266                 return False;
00267         if(!prs_align(ps))
00268                 return False;
00269 
00270         if(!prs_uint32("access", ps, depth, &q_u->access))
00271                 return False;
00272 
00273         return True;
00274 }
00275 
00276 /*******************************************************************
00277 ********************************************************************/
00278 
00279 BOOL svcctl_io_r_open_scmanager(const char *desc, SVCCTL_R_OPEN_SCMANAGER *r_u, prs_struct *ps, int depth)
00280 {
00281         if (r_u == NULL)
00282                 return False;
00283 
00284         prs_debug(ps, depth, desc, "svcctl_io_r_open_scmanager");
00285         depth++;
00286 
00287         if(!prs_align(ps))
00288                 return False;
00289 
00290         if(!smb_io_pol_hnd("scm_pol", &r_u->handle, ps, depth))
00291                 return False;
00292 
00293         if(!prs_werror("status", ps, depth, &r_u->status))
00294                 return False;
00295 
00296         return True;
00297 }
00298 
00299 /*******************************************************************
00300 ********************************************************************/
00301 
00302 BOOL svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q_u, prs_struct *ps, int depth)
00303 {
00304         if (q_u == NULL)
00305                 return False;
00306 
00307         prs_debug(ps, depth, desc, "svcctl_io_q_get_display_name");
00308         depth++;
00309 
00310         if(!prs_align(ps))
00311                 return False;
00312 
00313         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
00314                 return False;
00315 
00316         if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
00317                 return False;
00318 
00319         if(!prs_align(ps))
00320                 return False;
00321 
00322         if(!prs_uint32("display_name_len", ps, depth, &q_u->display_name_len))
00323                 return False;
00324         
00325         return True;
00326 }
00327 
00328 /*******************************************************************
00329 ********************************************************************/
00330 
00331 BOOL init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char *displayname )
00332 {
00333         r_u->display_name_len = strlen(displayname);
00334         init_unistr2( &r_u->displayname, displayname, UNI_STR_TERMINATE );
00335 
00336         return True;
00337 }
00338 
00339 /*******************************************************************
00340 ********************************************************************/
00341 
00342 BOOL svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r_u, prs_struct *ps, int depth)
00343 {
00344         if (r_u == NULL)
00345                 return False;
00346 
00347         prs_debug(ps, depth, desc, "svcctl_io_r_get_display_name");
00348         depth++;
00349 
00350         if(!prs_align(ps))
00351                 return False;
00352 
00353         
00354         if(!smb_io_unistr2("displayname", &r_u->displayname, 1, ps, depth))
00355                 return False;
00356 
00357         if(!prs_align(ps))
00358                 return False;
00359 
00360         if(!prs_uint32("display_name_len", ps, depth, &r_u->display_name_len))
00361                 return False;
00362 
00363         if(!prs_werror("status", ps, depth, &r_u->status))
00364                 return False;
00365 
00366         return True;
00367 }
00368 
00369 
00370 /*******************************************************************
00371 ********************************************************************/
00372 
00373 BOOL svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
00374 {
00375         if (q_u == NULL)
00376                 return False;
00377 
00378         prs_debug(ps, depth, desc, "svcctl_io_q_open_service");
00379         depth++;
00380 
00381         if(!prs_align(ps))
00382                 return False;
00383 
00384         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
00385                 return False;
00386 
00387         if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
00388                 return False;
00389 
00390         if(!prs_align(ps))
00391                 return False;
00392 
00393         if(!prs_uint32("access", ps, depth, &q_u->access))
00394                 return False;
00395         
00396         return True;
00397 }
00398 
00399 /*******************************************************************
00400 ********************************************************************/
00401 
00402 BOOL svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
00403 {
00404         if (r_u == NULL)
00405                 return False;
00406 
00407         prs_debug(ps, depth, desc, "svcctl_io_r_open_service");
00408         depth++;
00409 
00410         if(!prs_align(ps))
00411                 return False;
00412 
00413         if(!smb_io_pol_hnd("service_pol", &r_u->handle, ps, depth))
00414                 return False;
00415 
00416         if(!prs_werror("status", ps, depth, &r_u->status))
00417                 return False;
00418 
00419         return True;
00420 }
00421 
00422 /*******************************************************************
00423 ********************************************************************/
00424 
00425 BOOL svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_struct *ps, int depth)
00426 {
00427         if (q_u == NULL)
00428                 return False;
00429 
00430         prs_debug(ps, depth, desc, "svcctl_io_q_query_status");
00431         depth++;
00432 
00433         if(!prs_align(ps))
00434                 return False;
00435 
00436         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00437                 return False;
00438         
00439         return True;
00440 }
00441 
00442 /*******************************************************************
00443 ********************************************************************/
00444 
00445 BOOL svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_struct *ps, int depth)
00446 {
00447         if (r_u == NULL)
00448                 return False;
00449 
00450         prs_debug(ps, depth, desc, "svcctl_io_r_query_status");
00451         depth++;
00452 
00453         if(!prs_align(ps))
00454                 return False;
00455 
00456         if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
00457                 return False;
00458 
00459         if(!prs_werror("status", ps, depth, &r_u->status))
00460                 return False;
00461 
00462         return True;
00463 }
00464 
00465 /*******************************************************************
00466 ********************************************************************/
00467 
00468 BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth)
00469 {
00470         if (q_u == NULL)
00471                 return False;
00472 
00473         prs_debug(ps, depth, desc, "svcctl_io_q_enum_services_status");
00474         depth++;
00475 
00476         if(!prs_align(ps))
00477                 return False;
00478 
00479         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
00480                 return False;
00481 
00482         if(!prs_uint32("type", ps, depth, &q_u->type))
00483                 return False;
00484         if(!prs_uint32("state", ps, depth, &q_u->state))
00485                 return False;
00486         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
00487                 return False;
00488 
00489         if(!prs_pointer("resume", ps, depth, (void*)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
00490                 return False;
00491         
00492         return True;
00493 }
00494 
00495 /*******************************************************************
00496 ********************************************************************/
00497 
00498 BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth)
00499 {
00500         if (r_u == NULL)
00501                 return False;
00502 
00503         prs_debug(ps, depth, desc, "svcctl_io_r_enum_services_status");
00504         depth++;
00505 
00506         if(!prs_align(ps))
00507                 return False;
00508 
00509         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
00510                 return False;
00511 
00512         if(!prs_align(ps))
00513                 return False;
00514 
00515         if(!prs_uint32("needed", ps, depth, &r_u->needed))
00516                 return False;
00517         if(!prs_uint32("returned", ps, depth, &r_u->returned))
00518                 return False;
00519 
00520         if(!prs_pointer("resume", ps, depth, (void*)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
00521                 return False;
00522 
00523         if(!prs_werror("status", ps, depth, &r_u->status))
00524                 return False;
00525 
00526         return True;
00527 }
00528 
00529 /*******************************************************************
00530 ********************************************************************/
00531 
00532 BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, prs_struct *ps, int depth)
00533 {
00534         if (q_u == NULL)
00535                 return False;
00536 
00537         prs_debug(ps, depth, desc, "svcctl_io_q_start_service");
00538         depth++;
00539 
00540         if(!prs_align(ps))
00541                 return False;
00542 
00543         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00544                 return False;
00545 
00546         if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount))
00547                 return False;
00548 
00549         if ( !prs_pointer("rights", ps, depth, (void*)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
00550                 return False;
00551 
00552         return True;
00553 }
00554 
00555 /*******************************************************************
00556 ********************************************************************/
00557 
00558 BOOL svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, prs_struct *ps, int depth)
00559 {
00560         if (r_u == NULL)
00561                 return False;
00562 
00563         prs_debug(ps, depth, desc, "svcctl_io_r_start_service");
00564         depth++;
00565 
00566         if(!prs_werror("status", ps, depth, &r_u->status))
00567                 return False;
00568 
00569         return True;
00570 }
00571 
00572 
00573 /*******************************************************************
00574 ********************************************************************/
00575 
00576 BOOL svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth)
00577 {
00578         if (q_u == NULL)
00579                 return False;
00580 
00581         prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services");
00582         depth++;
00583 
00584         if(!prs_align(ps))
00585                 return False;
00586 
00587         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00588                 return False;
00589 
00590         if(!prs_uint32("state", ps, depth, &q_u->state))
00591                 return False;
00592         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
00593                 return False;
00594 
00595         return True;
00596 }
00597 
00598 /*******************************************************************
00599 ********************************************************************/
00600 
00601 BOOL svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth)
00602 {
00603         if (r_u == NULL)
00604                 return False;
00605 
00606         prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services");
00607         depth++;
00608 
00609         if(!prs_align(ps))
00610                 return False;
00611 
00612         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
00613                 return False;
00614 
00615         if(!prs_align(ps))
00616                 return False;
00617 
00618         if(!prs_uint32("needed", ps, depth, &r_u->needed))
00619                 return False;
00620         if(!prs_uint32("returned", ps, depth, &r_u->returned))
00621                 return False;
00622 
00623         if(!prs_werror("status", ps, depth, &r_u->status))
00624                 return False;
00625 
00626         return True;
00627 }
00628 
00629 /*******************************************************************
00630 ********************************************************************/
00631 
00632 BOOL svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u, prs_struct *ps, int depth)
00633 {
00634         if (q_u == NULL)
00635                 return False;
00636 
00637         prs_debug(ps, depth, desc, "svcctl_io_q_control_service");
00638         depth++;
00639 
00640         if(!prs_align(ps))
00641                 return False;
00642 
00643         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00644                 return False;
00645 
00646         if(!prs_uint32("control", ps, depth, &q_u->control))
00647                 return False;
00648 
00649         return True;
00650 }
00651 
00652 /*******************************************************************
00653 ********************************************************************/
00654 
00655 BOOL svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth)
00656 {
00657         if (r_u == NULL)
00658                 return False;
00659 
00660         prs_debug(ps, depth, desc, "svcctl_io_r_control_service");
00661         depth++;
00662 
00663         if(!prs_align(ps))
00664                 return False;
00665 
00666         if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
00667                 return False;
00668 
00669         if(!prs_werror("status", ps, depth, &r_u->status))
00670                 return False;
00671 
00672         return True;
00673 }
00674 
00675 
00676 /*******************************************************************
00677 ********************************************************************/
00678 
00679 BOOL svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
00680 {
00681         if (q_u == NULL)
00682                 return False;
00683 
00684         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config");
00685         depth++;
00686 
00687         if(!prs_align(ps))
00688                 return False;
00689 
00690         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00691                 return False;
00692 
00693         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
00694                 return False;
00695 
00696         return True;
00697 }
00698 
00699 /*******************************************************************
00700 ********************************************************************/
00701 
00702 BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth)
00703 {
00704         if (r_u == NULL)
00705                 return False;
00706 
00707         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config");
00708         depth++;
00709 
00710 
00711         if(!prs_align(ps))
00712                 return False;
00713 
00714         if(!svcctl_io_service_config("config", &r_u->config, ps, depth))
00715                 return False;
00716 
00717         if(!prs_uint32("needed", ps, depth, &r_u->needed))
00718                 return False;
00719 
00720         if(!prs_werror("status", ps, depth, &r_u->status))
00721                 return False;
00722 
00723 
00724         return True;
00725 }
00726 
00727 /*******************************************************************
00728 ********************************************************************/
00729 
00730 BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth)
00731 {
00732         if (q_u == NULL)
00733                 return False;
00734 
00735         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config2");
00736         depth++;
00737 
00738         if(!prs_align(ps))
00739                 return False;
00740 
00741         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00742                 return False;
00743 
00744         if(!prs_uint32("level", ps, depth, &q_u->level))
00745                 return False;
00746 
00747         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
00748                 return False;
00749 
00750         return True;
00751 }
00752 
00753 
00754 /*******************************************************************
00755 ********************************************************************/
00756 
00757 void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc )
00758 {
00759         desc->unknown = 0x04;   /* always 0x0000 0004 (no idea what this is) */
00760         init_unistr( &desc->description, service_desc );
00761 }
00762 
00763 /*******************************************************************
00764 ********************************************************************/
00765 
00766 BOOL svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth )
00767 {
00768         prs_struct *ps = &buffer->prs;
00769 
00770         prs_debug(ps, depth, desc, "svcctl_io_service_description");
00771         depth++;
00772 
00773         if ( !prs_uint32("unknown", ps, depth, &description->unknown) )
00774                 return False;
00775         if ( !prs_unistr("description", ps, depth, &description->description) )
00776                 return False;
00777 
00778         return True;
00779 } 
00780 
00781 /*******************************************************************
00782 ********************************************************************/
00783 
00784 uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc )
00785 {
00786         if ( !desc )
00787                 return 0;
00788 
00789         /* make sure to include the terminating NULL */
00790         return ( sizeof(uint32) + (2*(str_len_uni(&desc->description)+1)) );
00791 }
00792 
00793 /*******************************************************************
00794 ********************************************************************/
00795 
00796 static BOOL svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth )
00797 {
00798 
00799         prs_debug(ps, depth, desc, "svcctl_io_action");
00800         depth++;
00801 
00802         if ( !prs_uint32("type", ps, depth, &action->type) )
00803                 return False;
00804         if ( !prs_uint32("delay", ps, depth, &action->delay) )
00805                 return False;
00806 
00807         return True;
00808 }
00809 
00810 /*******************************************************************
00811 ********************************************************************/
00812 
00813 BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth )
00814 {
00815         prs_struct *ps = &buffer->prs;
00816         int i;
00817 
00818         prs_debug(ps, depth, desc, "svcctl_io_service_description");
00819         depth++;
00820 
00821         if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) )
00822                 return False;
00823 
00824         if ( !prs_pointer( desc, ps, depth, (void*)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
00825                 return False;
00826         if ( !prs_pointer( desc, ps, depth, (void*)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
00827                 return False;
00828 
00829         if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) )
00830                 return False;
00831 
00832         if ( UNMARSHALLING(ps)) {
00833                 if (fa->num_actions) {
00834                         if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) {
00835                                 DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n"));
00836                                 return False;
00837                         }
00838                 } else {
00839                         fa->actions = NULL;
00840                 }
00841         }
00842 
00843         for ( i=0; i<fa->num_actions; i++ ) {
00844                 if ( !svcctl_io_action( "actions", &fa->actions[i], ps, depth ) )
00845                         return False;
00846         }
00847 
00848         return True;
00849 } 
00850 
00851 /*******************************************************************
00852 ********************************************************************/
00853 
00854 uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa)
00855 {
00856         uint32 size = 0;
00857 
00858         if ( !fa )
00859                 return 0;
00860 
00861         size  = sizeof(uint32) * 2;
00862         size += sizeof_unistr2( fa->rebootmsg );
00863         size += sizeof_unistr2( fa->command );
00864         size += sizeof(SC_ACTION) * fa->num_actions;
00865 
00866         return size;
00867 }
00868 
00869 /*******************************************************************
00870 ********************************************************************/
00871 
00872 BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth)
00873 {
00874         if ( !r_u )
00875                 return False;
00876 
00877         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2");
00878         depth++;
00879 
00880         if ( !prs_align(ps) )
00881                 return False;
00882 
00883         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
00884                 return False;
00885         if(!prs_align(ps))
00886                 return False;
00887 
00888         if (!prs_uint32("needed", ps, depth, &r_u->needed))
00889                 return False;
00890 
00891         if(!prs_werror("status", ps, depth, &r_u->status))
00892                 return False;
00893 
00894         return True;
00895 }
00896 
00897 
00898 /*******************************************************************
00899 ********************************************************************/
00900 
00901 BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth)
00902 {
00903         if (q_u == NULL)
00904                 return False;
00905 
00906         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_status_ex");
00907         depth++;
00908 
00909         if(!prs_align(ps))
00910                 return False;
00911 
00912         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
00913                 return False;
00914 
00915         if(!prs_uint32("level", ps, depth, &q_u->level))
00916                 return False;
00917 
00918         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
00919                 return False;
00920 
00921         return True;
00922 
00923 }
00924 
00925 /*******************************************************************
00926 ********************************************************************/
00927 
00928 BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth)
00929 {
00930         if ( !r_u )
00931                 return False;
00932 
00933         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex");
00934         depth++;
00935 
00936         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
00937                 return False;
00938 
00939         if(!prs_align(ps))
00940                 return False;
00941 
00942         if(!prs_uint32("needed", ps, depth, &r_u->needed))
00943                 return False;
00944 
00945         if(!prs_werror("status", ps, depth, &r_u->status))
00946                 return False;
00947 
00948         return True;
00949 }
00950 
00951 /*******************************************************************
00952 ********************************************************************/
00953 
00954 BOOL svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
00955 {
00956         if (q_u == NULL)
00957                 return False;
00958 
00959         prs_debug(ps, depth, desc, "svcctl_io_q_lock_service_db");
00960         depth++;
00961 
00962         if(!prs_align(ps))
00963                 return False;
00964 
00965         if(!smb_io_pol_hnd("scm_handle", &q_u->handle, ps, depth))
00966                 return False;
00967 
00968         return True;
00969 
00970 }
00971 
00972 /*******************************************************************
00973 ********************************************************************/
00974 
00975 BOOL svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
00976 {
00977         if ( !r_u )
00978                 return False;
00979 
00980         prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db");
00981         depth++;
00982 
00983         if(!prs_align(ps))
00984                 return False;
00985 
00986         if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth))
00987                 return False;
00988 
00989         if(!prs_werror("status", ps, depth, &r_u->status))
00990                 return False;
00991 
00992         return True;
00993 }
00994 
00995 /*******************************************************************
00996 ********************************************************************/
00997 
00998 BOOL svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
00999 {
01000         if (q_u == NULL)
01001                 return False;
01002 
01003         prs_debug(ps, depth, desc, "svcctl_io_q_unlock_service_db");
01004         depth++;
01005 
01006         if(!prs_align(ps))
01007                 return False;
01008 
01009         if(!smb_io_pol_hnd("h_lock", &q_u->h_lock, ps, depth))
01010                 return False;
01011 
01012         return True;
01013 
01014 }
01015 
01016 /*******************************************************************
01017 ********************************************************************/
01018 
01019 BOOL svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
01020 {
01021         if ( !r_u )
01022                 return False;
01023 
01024         prs_debug(ps, depth, desc, "svcctl_io_r_unlock_service_db");
01025         depth++;
01026 
01027         if(!prs_align(ps))
01028                 return False;
01029 
01030         if(!prs_werror("status", ps, depth, &r_u->status))
01031                 return False;
01032 
01033         return True;
01034 }
01035 
01036 /*******************************************************************
01037 ********************************************************************/
01038 
01039 BOOL svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC *q_u, prs_struct *ps, int depth)
01040 {
01041         if (q_u == NULL)
01042                 return False;
01043 
01044         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_sec");
01045         depth++;
01046 
01047         if(!prs_align(ps))
01048                 return False;
01049 
01050         if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
01051                 return False;
01052         if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
01053                 return False;
01054         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
01055                 return False;
01056 
01057         return True;
01058 
01059 }
01060 
01061 /*******************************************************************
01062 ********************************************************************/
01063 
01064 BOOL svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC *r_u, prs_struct *ps, int depth)
01065 {
01066         if ( !r_u )
01067                 return False;
01068 
01069         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_sec");
01070         depth++;
01071 
01072         if(!prs_align(ps))
01073                 return False;
01074 
01075         if (!prs_rpcbuffer("buffer", ps, depth, &r_u->buffer))
01076                 return False;
01077 
01078         if(!prs_uint32("needed", ps, depth, &r_u->needed))
01079                 return False;
01080 
01081         if(!prs_werror("status", ps, depth, &r_u->status))
01082                 return False;
01083 
01084         return True;
01085 }
01086 
01087 /*******************************************************************
01088 ********************************************************************/
01089 
01090 BOOL svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u, prs_struct *ps, int depth)
01091 {
01092         if (q_u == NULL)
01093                 return False;
01094 
01095         prs_debug(ps, depth, desc, "svcctl_io_q_set_service_sec");
01096         depth++;
01097 
01098         if(!prs_align(ps))
01099                 return False;
01100 
01101         if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
01102                 return False;
01103         if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
01104                 return False;
01105 
01106         if (!prs_rpcbuffer("buffer", ps, depth, &q_u->buffer))
01107                 return False;
01108 
01109         if(!prs_align(ps))
01110                 return False;
01111 
01112         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
01113                 return False;
01114 
01115         return True;
01116 
01117 }
01118 
01119 /*******************************************************************
01120 ********************************************************************/
01121 
01122 BOOL svcctl_io_r_set_service_sec(const char *desc, SVCCTL_R_SET_SERVICE_SEC *r_u, prs_struct *ps, int depth)
01123 {
01124         if ( !r_u )
01125                 return False;
01126 
01127         prs_debug(ps, depth, desc, "svcctl_io_r_set_service_sec");
01128         depth++;
01129 
01130         if(!prs_align(ps))
01131                 return False;
01132 
01133         if(!prs_werror("status", ps, depth, &r_u->status))
01134                 return False;
01135 
01136         return True;
01137 }
01138 
01139 
01140 
01141 

Sambaに対してSat Aug 29 21:23:19 2009に生成されました。  doxygen 1.4.7