rpc_parse/parse_srv.c

説明を見る。
00001 /* 
00002  *  Unix SMB/CIFS implementation.
00003  *  RPC Pipe client / server routines
00004  *  Copyright (C) Andrew Tridgell              1992-1997,
00005  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
00006  *  Copyright (C) Paul Ashton                       1997,
00007  *  Copyright (C) Jeremy Allison                    1999,
00008  *  Copyright (C) Nigel Williams                    2001,
00009  *  Copyright (C) Jim McDonough (jmcd@us.ibm.com)   2002.
00010  *  Copyright (C) Gerald (Jerry) Carter             2006.
00011  *  
00012  *  This program is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU General Public License as published by
00014  *  the Free Software Foundation; either version 2 of the License, or
00015  *  (at your option) any later version.
00016  *  
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU General Public License for more details.
00021  *  
00022  *  You should have received a copy of the GNU General Public License
00023  *  along with this program; if not, write to the Free Software
00024  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  */
00026 
00027 #include "includes.h"
00028 
00029 #undef DBGC_CLASS
00030 #define DBGC_CLASS DBGC_RPC_PARSE
00031 
00032 /*******************************************************************
00033  Inits a SH_INFO_0_STR structure
00034 ********************************************************************/
00035 
00036 void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name)
00037 {
00038         DEBUG(5,("init_srv_share_info0_str\n"));
00039 
00040         init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE);
00041 }
00042 
00043 /*******************************************************************
00044  Reads or writes a structure.
00045 ********************************************************************/
00046 
00047 static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth)
00048 {
00049         if (sh0 == NULL)
00050                 return False;
00051 
00052         prs_debug(ps, depth, desc, "srv_io_share_info0_str");
00053         depth++;
00054 
00055         if(!prs_align(ps))
00056                 return False;
00057         if(sh0->ptrs->ptr_netname)
00058                 if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth))
00059                         return False;
00060 
00061         return True;
00062 }
00063 
00064 /*******************************************************************
00065  makes a SH_INFO_0 structure
00066 ********************************************************************/
00067 
00068 void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name)
00069 {
00070         DEBUG(5,("init_srv_share_info0: %s\n", net_name));
00071 
00072         sh0->ptr_netname = (net_name != NULL) ? 1 : 0;
00073 }
00074 
00075 /*******************************************************************
00076  Reads or writes a structure.
00077 ********************************************************************/
00078 
00079 static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth)
00080 {
00081         if (sh0 == NULL)
00082                 return False;
00083 
00084         prs_debug(ps, depth, desc, "srv_io_share_info0");
00085         depth++;
00086 
00087         if(!prs_align(ps))
00088                 return False;
00089 
00090         if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname))
00091                 return False;
00092 
00093         return True;
00094 }
00095 
00096 /*******************************************************************
00097  Inits a SH_INFO_1_STR structure
00098 ********************************************************************/
00099 
00100 void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark)
00101 {
00102         DEBUG(5,("init_srv_share_info1_str\n"));
00103 
00104         init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE);
00105         init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE);
00106 }
00107 
00108 /*******************************************************************
00109  Reads or writes a structure.
00110 ********************************************************************/
00111 
00112 static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth)
00113 {
00114         if (sh1 == NULL)
00115                 return False;
00116         
00117         prs_debug(ps, depth, desc, "srv_io_share_info1_str");
00118         depth++;
00119         
00120         if(!prs_align(ps))
00121                 return False;
00122 
00123         if(sh1->ptrs->ptr_netname)
00124                 if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth))
00125                         return False;
00126         
00127         if(!prs_align(ps))
00128                 return False;
00129         
00130         if(sh1->ptrs->ptr_remark)
00131                 if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth))
00132                         return False;
00133         
00134         return True;
00135 }
00136 
00137 /*******************************************************************
00138  makes a SH_INFO_1 structure
00139 ********************************************************************/
00140 
00141 void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark)
00142 {
00143         DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark));
00144         
00145         sh1->ptr_netname = (net_name != NULL) ? 1 : 0;
00146         sh1->type        = type;
00147         sh1->ptr_remark  = (remark != NULL) ? 1 : 0;
00148 }
00149 
00150 /*******************************************************************
00151  Reads or writes a structure.
00152 ********************************************************************/
00153 
00154 static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth)
00155 {
00156         if (sh1 == NULL)
00157                 return False;
00158 
00159         prs_debug(ps, depth, desc, "srv_io_share_info1");
00160         depth++;
00161 
00162         if(!prs_align(ps))
00163                 return False;
00164 
00165         if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname))
00166                 return False;
00167         if(!prs_uint32("type       ", ps, depth, &sh1->type))
00168                 return False;
00169         if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark))
00170                 return False;
00171 
00172         return True;
00173 }
00174 
00175 /*******************************************************************
00176  Inits a SH_INFO_2_STR structure
00177 ********************************************************************/
00178 
00179 void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
00180                                 const char *net_name, const char *remark,
00181                                 const char *path, const char *passwd)
00182 {
00183         DEBUG(5,("init_srv_share_info2_str\n"));
00184 
00185         init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE);
00186         init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE);
00187         init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE);
00188         init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE);
00189 }
00190 
00191 /*******************************************************************
00192  Reads or writes a structure.
00193 ********************************************************************/
00194 
00195 static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
00196 {
00197         if (sh2 == NULL)
00198                 return False;
00199 
00200         if (UNMARSHALLING(ps))
00201                 ZERO_STRUCTP(sh2);
00202 
00203         prs_debug(ps, depth, desc, "srv_io_share_info2_str");
00204         depth++;
00205 
00206         if(!prs_align(ps))
00207                 return False;
00208 
00209         if (sh->ptr_netname)
00210                 if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
00211                         return False;
00212 
00213         if (sh->ptr_remark)
00214                 if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
00215                         return False;
00216 
00217         if (sh->ptr_netname)
00218                 if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
00219                         return False;
00220 
00221         if (sh->ptr_passwd)
00222                 if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
00223                         return False;
00224 
00225         return True;
00226 }
00227 
00228 /*******************************************************************
00229  Inits a SH_INFO_2 structure
00230 ********************************************************************/
00231 
00232 void init_srv_share_info2(SH_INFO_2 *sh2,
00233                                 const char *net_name, uint32 type, const char *remark,
00234                                 uint32 perms, uint32 max_uses, uint32 num_uses,
00235                                 const char *path, const char *passwd)
00236 {
00237         DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark));
00238 
00239         sh2->ptr_netname = (net_name != NULL) ? 1 : 0;
00240         sh2->type        = type;
00241         sh2->ptr_remark  = (remark != NULL) ? 1 : 0;
00242         sh2->perms       = perms;
00243         sh2->max_uses    = max_uses;
00244         sh2->num_uses    = num_uses;
00245         sh2->ptr_path    = (path != NULL) ? 1 : 0;
00246         sh2->ptr_passwd  = (passwd != NULL) ? 1 : 0;
00247 }
00248 
00249 /*******************************************************************
00250  Reads or writes a structure.
00251 ********************************************************************/
00252 
00253 static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth)
00254 {
00255         if (sh2 == NULL)
00256                 return False;
00257 
00258         prs_debug(ps, depth, desc, "srv_io_share_info2");
00259         depth++;
00260 
00261         if(!prs_align(ps))
00262                 return False;
00263 
00264         if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname))
00265                 return False;
00266         if(!prs_uint32("type       ", ps, depth, &sh2->type))
00267                 return False;
00268         if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark))
00269                 return False;
00270         if(!prs_uint32("perms      ", ps, depth, &sh2->perms))
00271                 return False;
00272         if(!prs_uint32("max_uses   ", ps, depth, &sh2->max_uses))
00273                 return False;
00274         if(!prs_uint32("num_uses   ", ps, depth, &sh2->num_uses))
00275                 return False;
00276         if(!prs_uint32("ptr_path   ", ps, depth, &sh2->ptr_path))
00277                 return False;
00278         if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd))
00279                 return False;
00280 
00281         return True;
00282 }
00283 
00284 /*******************************************************************
00285  Inits a SH_INFO_501_STR structure
00286 ********************************************************************/
00287 
00288 void init_srv_share_info501_str(SH_INFO_501_STR *sh501,
00289                                 const char *net_name, const char *remark)
00290 {
00291         DEBUG(5,("init_srv_share_info501_str\n"));
00292 
00293         init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE);
00294         init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE);
00295 }
00296 
00297 /*******************************************************************
00298  Inits a SH_INFO_2 structure
00299 *******************************************************************/
00300 
00301 void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy)
00302 {
00303         DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type,
00304                 remark, csc_policy));
00305 
00306         ZERO_STRUCTP(sh501);
00307 
00308         sh501->ptr_netname = (net_name != NULL) ? 1 : 0;
00309         sh501->type = type;
00310         sh501->ptr_remark = (remark != NULL) ? 1 : 0;
00311         sh501->csc_policy = csc_policy;
00312 }
00313 
00314 /*******************************************************************
00315  Reads of writes a structure.
00316 *******************************************************************/
00317 
00318 static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth)
00319 {
00320         if (sh501 == NULL)
00321                 return False;
00322 
00323         prs_debug(ps, depth, desc, "srv_io_share_info501");
00324         depth++;
00325 
00326         if (!prs_align(ps))
00327                 return False;
00328 
00329         if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname))
00330                 return False;
00331         if (!prs_uint32("type     ", ps, depth, &sh501->type))
00332                 return False;
00333         if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark))
00334                 return False;
00335         if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy))
00336                 return False;
00337 
00338         return True;
00339 }
00340 
00341 /*******************************************************************
00342  Reads or writes a structure.
00343 ********************************************************************/
00344 
00345 static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth)
00346 {
00347         if (sh501 == NULL)
00348                 return False;
00349 
00350         prs_debug(ps, depth, desc, "srv_io_share_info501_str");
00351         depth++;
00352 
00353         if(!prs_align(ps))
00354                 return False;
00355         if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth))
00356                 return False;
00357 
00358         if(!prs_align(ps))
00359                 return False;
00360         if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth))
00361                 return False;
00362 
00363         return True;
00364 }
00365 
00366 /*******************************************************************
00367  Inits a SH_INFO_502 structure
00368 ********************************************************************/
00369 
00370 void init_srv_share_info502(SH_INFO_502 *sh502,
00371                                 const char *net_name, uint32 type, const char *remark,
00372                                 uint32 perms, uint32 max_uses, uint32 num_uses,
00373                                 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
00374 {
00375         DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark));
00376 
00377         ZERO_STRUCTP(sh502);
00378 
00379         sh502->ptr_netname = (net_name != NULL) ? 1 : 0;
00380         sh502->type        = type;
00381         sh502->ptr_remark  = (remark != NULL) ? 1 : 0;
00382         sh502->perms       = perms;
00383         sh502->max_uses    = max_uses;
00384         sh502->num_uses    = num_uses;
00385         sh502->ptr_path    = (path != NULL) ? 1 : 0;
00386         sh502->ptr_passwd  = (passwd != NULL) ? 1 : 0;
00387         sh502->reserved    = 0;  /* actual size within rpc */
00388         sh502->sd_size     = (uint32)sd_size;
00389         sh502->ptr_sd      = (psd != NULL) ? 1 : 0;
00390 }
00391 
00392 /*******************************************************************
00393  Reads or writes a structure.
00394 ********************************************************************/
00395 
00396 static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth)
00397 {
00398         if (sh502 == NULL)
00399                 return False;
00400 
00401         prs_debug(ps, depth, desc, "srv_io_share_info502");
00402         depth++;
00403 
00404         if(!prs_align(ps))
00405                 return False;
00406 
00407         if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname))
00408                 return False;
00409         if(!prs_uint32("type       ", ps, depth, &sh502->type))
00410                 return False;
00411         if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark))
00412                 return False;
00413         if(!prs_uint32("perms      ", ps, depth, &sh502->perms))
00414                 return False;
00415         if(!prs_uint32("max_uses   ", ps, depth, &sh502->max_uses))
00416                 return False;
00417         if(!prs_uint32("num_uses   ", ps, depth, &sh502->num_uses))
00418                 return False;
00419         if(!prs_uint32("ptr_path   ", ps, depth, &sh502->ptr_path))
00420                 return False;
00421         if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd))
00422                 return False;
00423         if(!prs_uint32_pre("reserved   ", ps, depth, &sh502->reserved, &sh502->reserved_offset))
00424                 return False;
00425         if(!prs_uint32("ptr_sd     ", ps, depth, &sh502->ptr_sd))
00426                 return False;
00427 
00428         return True;
00429 }
00430 
00431 /*******************************************************************
00432  Inits a SH_INFO_502_STR structure
00433 ********************************************************************/
00434 
00435 void init_srv_share_info502_str(SH_INFO_502_STR *sh502str,
00436                                 const char *net_name, const char *remark,
00437                                 const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size)
00438 {
00439         DEBUG(5,("init_srv_share_info502_str\n"));
00440 
00441         init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE);
00442         init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE);
00443         init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE);
00444         init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE);
00445         sh502str->sd = psd;
00446         sh502str->reserved = 0;
00447         sh502str->sd_size = sd_size;
00448 }
00449 
00450 /*******************************************************************
00451  Reads or writes a structure.
00452 ********************************************************************/
00453 
00454 static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth)
00455 {
00456         if (sh502 == NULL)
00457                 return False;
00458 
00459         prs_debug(ps, depth, desc, "srv_io_share_info502_str");
00460         depth++;
00461 
00462         if(!prs_align(ps))
00463                 return False;
00464 
00465         if(sh502->ptrs->ptr_netname) {
00466                 if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth))
00467                         return False;
00468         }
00469 
00470         if(!prs_align(ps))
00471                 return False;
00472 
00473         if(sh502->ptrs->ptr_remark) {
00474                 if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth))
00475                         return False;
00476         }
00477 
00478         if(!prs_align(ps))
00479                 return False;
00480 
00481         if(sh502->ptrs->ptr_path) {
00482                 if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth))
00483                         return False;
00484         }
00485 
00486         if(!prs_align(ps))
00487                 return False;
00488 
00489         if(sh502->ptrs->ptr_passwd) {
00490                 if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth))
00491                         return False;
00492         }
00493 
00494         if(!prs_align(ps))
00495                 return False;
00496 
00497         if(sh502->ptrs->ptr_sd) {
00498                 uint32 old_offset;
00499                 uint32 reserved_offset;
00500 
00501                 if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset))
00502                         return False;
00503           
00504                 old_offset = prs_offset(ps);
00505           
00506                 if (!sec_io_desc(desc, &sh502->sd, ps, depth))
00507                         return False;
00508 
00509                 if(UNMARSHALLING(ps)) {
00510 
00511                         sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
00512 
00513                         prs_set_offset(ps, old_offset + sh502->reserved);
00514                 }
00515 
00516                 prs_align(ps);
00517 
00518                 if(MARSHALLING(ps)) {
00519 
00520                         sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset;
00521                 }
00522             
00523                 if(!prs_uint32_post("reserved ", ps, depth, 
00524                                     &sh502->reserved, reserved_offset, sh502->reserved))
00525                         return False;
00526                 if(!prs_uint32_post("reserved ", ps, depth, 
00527                                     &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved))
00528                         return False;
00529         }
00530 
00531         return True;
00532 }
00533 
00534 /*******************************************************************
00535  Inits a SH_INFO_1004_STR structure
00536 ********************************************************************/
00537 
00538 void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark)
00539 {
00540         DEBUG(5,("init_srv_share_info1004_str\n"));
00541 
00542         init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE);
00543 }
00544 
00545 /*******************************************************************
00546  Reads or writes a structure.
00547 ********************************************************************/
00548 
00549 static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth)
00550 {
00551         if (sh1004 == NULL)
00552                 return False;
00553 
00554         prs_debug(ps, depth, desc, "srv_io_share_info1004_str");
00555         depth++;
00556 
00557         if(!prs_align(ps))
00558                 return False;
00559         if(sh1004->ptrs->ptr_remark)
00560                 if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth))
00561                         return False;
00562 
00563         return True;
00564 }
00565 
00566 /*******************************************************************
00567  makes a SH_INFO_1004 structure
00568 ********************************************************************/
00569 
00570 void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark)
00571 {
00572         DEBUG(5,("init_srv_share_info1004: %s\n", remark));
00573 
00574         sh1004->ptr_remark = (remark != NULL) ? 1 : 0;
00575 }
00576 
00577 /*******************************************************************
00578  Reads or writes a structure.
00579 ********************************************************************/
00580 
00581 static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth)
00582 {
00583         if (sh1004 == NULL)
00584                 return False;
00585 
00586         prs_debug(ps, depth, desc, "srv_io_share_info1004");
00587         depth++;
00588 
00589         if(!prs_align(ps))
00590                 return False;
00591 
00592         if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark))
00593                 return False;
00594 
00595         return True;
00596 }
00597 
00598 /*******************************************************************
00599  Reads or writes a structure.
00600 ********************************************************************/
00601 
00602 static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth)
00603 {
00604         if(sh1005 == NULL)
00605                 return False;
00606 
00607         prs_debug(ps, depth, desc, "srv_io_share_info1005");
00608                 depth++;
00609 
00610         if(!prs_align(ps))
00611                 return False;
00612 
00613         if(!prs_uint32("share_info_flags", ps, depth, 
00614                        &sh1005->share_info_flags))
00615                 return False;
00616 
00617         return True;
00618 }   
00619 
00620 /*******************************************************************
00621  Reads or writes a structure.
00622 ********************************************************************/
00623 
00624 static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth)
00625 {
00626         if(sh1006 == NULL)
00627                 return False;
00628 
00629         prs_debug(ps, depth, desc, "srv_io_share_info1006");
00630         depth++;
00631 
00632         if(!prs_align(ps))
00633                 return False;
00634 
00635         if(!prs_uint32("max uses     ", ps, depth, &sh1006->max_uses))
00636                 return False;
00637 
00638         return True;
00639 }   
00640 
00641 /*******************************************************************
00642  Inits a SH_INFO_1007_STR structure
00643 ********************************************************************/
00644 
00645 void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name)
00646 {
00647         DEBUG(5,("init_srv_share_info1007_str\n"));
00648 
00649         init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE);
00650 }
00651 
00652 /*******************************************************************
00653  Reads or writes a structure.
00654 ********************************************************************/
00655 
00656 static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth)
00657 {
00658         if (sh1007 == NULL)
00659                 return False;
00660 
00661         prs_debug(ps, depth, desc, "srv_io_share_info1007_str");
00662         depth++;
00663 
00664         if(!prs_align(ps))
00665                 return False;
00666         if(sh1007->ptrs->ptr_AlternateDirectoryName)
00667                 if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth))
00668                         return False;
00669 
00670         return True;
00671 }
00672 
00673 /*******************************************************************
00674  makes a SH_INFO_1007 structure
00675 ********************************************************************/
00676 
00677 void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name)
00678 {
00679         DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name));
00680 
00681         sh1007->flags                      = flags;
00682         sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0;
00683 }
00684 
00685 /*******************************************************************
00686  Reads or writes a structure.
00687 ********************************************************************/
00688 
00689 static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth)
00690 {
00691         if (sh1007 == NULL)
00692                 return False;
00693 
00694         prs_debug(ps, depth, desc, "srv_io_share_info1007");
00695         depth++;
00696 
00697         if(!prs_align(ps))
00698                 return False;
00699 
00700         if(!prs_uint32("flags      ", ps, depth, &sh1007->flags))
00701                 return False;
00702         if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName))
00703                 return False;
00704 
00705         return True;
00706 }
00707 
00708 /*******************************************************************
00709  Reads or writes a structure.
00710 ********************************************************************/
00711 
00712 static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501,
00713                                   prs_struct* ps, int depth)
00714 {
00715         if(sh1501 == NULL)
00716                 return False;
00717 
00718         prs_debug(ps, depth, desc, "srv_io_share_info1501");
00719         depth++;
00720 
00721         if(!prs_align(ps))
00722                 return False;
00723 
00724         if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth))
00725                 return False;
00726 
00727         return True;
00728 }   
00729 
00730 /*******************************************************************
00731  Reads or writes a structure.
00732 ********************************************************************/
00733 
00734 static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth)
00735 {
00736         if (ctr == NULL)
00737                 return False;
00738 
00739         prs_debug(ps, depth, desc, "srv_io_srv_share_ctr");
00740         depth++;
00741 
00742         if (UNMARSHALLING(ps)) {
00743                 memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR));
00744         }
00745 
00746         if(!prs_align(ps))
00747                 return False;
00748 
00749         if(!prs_uint32("info_level", ps, depth, &ctr->info_level))
00750                 return False;
00751 
00752         if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
00753                 return False;
00754         if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info))
00755                 return False;
00756 
00757         if (ctr->ptr_share_info == 0)
00758                 return True;
00759 
00760         if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
00761                 return False;
00762         if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
00763                 return False;
00764 
00765         if (ctr->ptr_entries == 0) {
00766                 if (ctr->num_entries == 0)
00767                         return True;
00768                 else
00769                         return False;
00770         }
00771 
00772         if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
00773                 return False;
00774 
00775         if (ctr->num_entries2 != ctr->num_entries)
00776                 return False;
00777 
00778         switch (ctr->switch_value) {
00779 
00780         case 0:
00781         {
00782                 SRV_SHARE_INFO_0 *info0 = ctr->share.info0;
00783                 int num_entries = ctr->num_entries;
00784                 int i;
00785 
00786                 if (UNMARSHALLING(ps) && num_entries) {
00787                         if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries)))
00788                                 return False;
00789                         ctr->share.info0 = info0;
00790                 }
00791 
00792                 for (i = 0; i < num_entries; i++) {
00793                         if(!srv_io_share_info0("", &info0[i].info_0, ps, depth))
00794                                 return False;
00795                 }
00796 
00797                 for (i = 0; i < num_entries; i++) {
00798                         info0[i].info_0_str.ptrs = &info0[i].info_0;
00799                         if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth))
00800                                 return False;
00801                 }
00802 
00803                 break;
00804         }
00805 
00806         case 1:
00807         {
00808                 SRV_SHARE_INFO_1 *info1 = ctr->share.info1;
00809                 int num_entries = ctr->num_entries;
00810                 int i;
00811 
00812                 if (UNMARSHALLING(ps) && num_entries) {
00813                         if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries)))
00814                                 return False;
00815                         ctr->share.info1 = info1;
00816                 }
00817 
00818                 for (i = 0; i < num_entries; i++) {
00819                         if(!srv_io_share_info1("", &info1[i].info_1, ps, depth))
00820                                 return False;
00821                 }
00822 
00823                 for (i = 0; i < num_entries; i++) {
00824                         info1[i].info_1_str.ptrs = &info1[i].info_1;
00825                         if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth))
00826                                 return False;
00827                 }
00828 
00829                 break;
00830         }
00831 
00832         case 2:
00833         {
00834                 SRV_SHARE_INFO_2 *info2 = ctr->share.info2;
00835                 int num_entries = ctr->num_entries;
00836                 int i;
00837 
00838                 if (UNMARSHALLING(ps) && num_entries) {
00839                         if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries)))
00840                                 return False;
00841                         ctr->share.info2 = info2;
00842                 }
00843 
00844                 for (i = 0; i < num_entries; i++) {
00845                         if(!srv_io_share_info2("", &info2[i].info_2, ps, depth))
00846                                 return False;
00847                 }
00848 
00849                 for (i = 0; i < num_entries; i++) {
00850                         if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
00851                                 return False;
00852                 }
00853 
00854                 break;
00855         }
00856 
00857         case 501:
00858         {
00859                 SRV_SHARE_INFO_501 *info501 = ctr->share.info501;
00860                 int num_entries = ctr->num_entries;
00861                 int i;
00862 
00863                 if (UNMARSHALLING(ps) && num_entries) {
00864                         if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries)))
00865                                 return False;
00866                         ctr->share.info501 = info501;
00867                 }
00868 
00869                 for (i = 0; i < num_entries; i++) {
00870                         if (!srv_io_share_info501("", &info501[i].info_501, ps, depth))
00871                                 return False;
00872                 }
00873 
00874                 for (i = 0; i < num_entries; i++) {
00875                         if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth))
00876                                 return False;
00877                 }
00878 
00879                 break;
00880         }
00881 
00882         case 502:
00883         {
00884                 SRV_SHARE_INFO_502 *info502 = ctr->share.info502;
00885                 int num_entries = ctr->num_entries;
00886                 int i;
00887 
00888                 if (UNMARSHALLING(ps) && num_entries) {
00889                         if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries)))
00890                                 return False;
00891                         ctr->share.info502 = info502;
00892                 }
00893 
00894                 for (i = 0; i < num_entries; i++) {
00895                         if(!srv_io_share_info502("", &info502[i].info_502, ps, depth))
00896                                 return False;
00897         }
00898                 
00899                 for (i = 0; i < num_entries; i++) {
00900                         info502[i].info_502_str.ptrs = &info502[i].info_502;
00901                         if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth))
00902                                 return False;
00903                 }
00904 
00905                 break;
00906         }
00907 
00908         case 1004:
00909         {
00910                 SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004;
00911                 int num_entries = ctr->num_entries;
00912                 int i;
00913 
00914                 if (UNMARSHALLING(ps) && num_entries) {
00915                         if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries)))
00916                                 return False;
00917                         ctr->share.info1004 = info1004;
00918                 }
00919 
00920                 for (i = 0; i < num_entries; i++) {
00921                         if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth))
00922                                 return False;
00923                 }
00924 
00925                 for (i = 0; i < num_entries; i++) {
00926                         info1004[i].info_1004_str.ptrs = &info1004[i].info_1004;
00927                         if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth))
00928                                 return False;
00929                 }
00930 
00931                 break;
00932         }
00933 
00934         case 1005:
00935         {
00936                 SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005;
00937                 int num_entries = ctr->num_entries;
00938                 int i;
00939 
00940                 if (UNMARSHALLING(ps) && num_entries) {
00941                         if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries)))
00942                                 return False;
00943                         ctr->share.info1005 = info1005;
00944                 }
00945 
00946                 for (i = 0; i < num_entries; i++) {
00947                         if(!srv_io_share_info1005("", &info1005[i], ps, depth))
00948                                 return False;
00949                 }
00950 
00951                 break;
00952         }
00953 
00954         case 1006:
00955         {
00956                 SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006;
00957                 int num_entries = ctr->num_entries;
00958                 int i;
00959 
00960                 if (UNMARSHALLING(ps) && num_entries) {
00961                         if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries)))
00962                                 return False;
00963                         ctr->share.info1006 = info1006;
00964                 }
00965 
00966                 for (i = 0; i < num_entries; i++) {
00967                         if(!srv_io_share_info1006("", &info1006[i], ps, depth))
00968                                 return False;
00969                 }
00970 
00971                 break;
00972         }
00973 
00974         case 1007:
00975         {
00976                 SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007;
00977                 int num_entries = ctr->num_entries;
00978                 int i;
00979 
00980                 if (UNMARSHALLING(ps) && num_entries) {
00981                         if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries)))
00982                                 return False;
00983                         ctr->share.info1007 = info1007;
00984                 }
00985 
00986                 for (i = 0; i < num_entries; i++) {
00987                         if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth))
00988                                 return False;
00989                 }
00990 
00991                 for (i = 0; i < num_entries; i++) {
00992                         info1007[i].info_1007_str.ptrs = &info1007[i].info_1007;
00993                         if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth))
00994                                 return False;
00995                 }
00996 
00997                 break;
00998         }
00999 
01000         case 1501:
01001         {
01002                 SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501;
01003                 int num_entries = ctr->num_entries;
01004                 int i;
01005 
01006                 if (UNMARSHALLING(ps) && num_entries) {
01007                         if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries)))
01008                                 return False;
01009                         ctr->share.info1501 = info1501;
01010                 }
01011 
01012                 for (i = 0; i < num_entries; i++) {
01013                         if(!srv_io_share_info1501("", &info1501[i], ps, depth))
01014                                 return False;
01015                 }
01016 
01017                 break;
01018         }
01019 
01020         default:
01021                 DEBUG(5,("%s no share info at switch_value %d\n",
01022                          tab_depth(depth), ctr->switch_value));
01023                 break;
01024         }
01025 
01026         return True;
01027 }
01028 
01029 /*******************************************************************
01030  Inits a SRV_Q_NET_SHARE_ENUM structure.
01031 ********************************************************************/
01032 
01033 void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, 
01034                                 const char *srv_name, uint32 info_level,
01035                                 uint32 preferred_len, ENUM_HND *hnd)
01036 {
01037 
01038         DEBUG(5,("init_q_net_share_enum\n"));
01039 
01040         init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
01041 
01042         q_n->ctr.info_level = q_n->ctr.switch_value = info_level;
01043         q_n->ctr.ptr_share_info = 1;
01044         q_n->ctr.num_entries  = 0;
01045         q_n->ctr.ptr_entries  = 0;
01046         q_n->ctr.num_entries2 = 0;
01047         q_n->preferred_len = preferred_len;
01048 
01049         memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
01050 }
01051 
01052 /*******************************************************************
01053  Reads or writes a structure.
01054 ********************************************************************/
01055 
01056 BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth)
01057 {
01058         if (q_n == NULL)
01059                 return False;
01060 
01061         prs_debug(ps, depth, desc, "srv_io_q_net_share_enum");
01062         depth++;
01063 
01064         if(!prs_align(ps))
01065                 return False;
01066 
01067         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01068                 return False;
01069         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01070                 return False;
01071 
01072         if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth))
01073                 return False;
01074 
01075         if(!prs_align(ps))
01076                 return False;
01077 
01078         if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
01079                 return False;
01080 
01081         if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
01082                 return False;
01083 
01084         return True;
01085 }
01086 
01087 /*******************************************************************
01088  Reads or writes a structure.
01089 ********************************************************************/
01090 
01091 BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth)
01092 {
01093         if (r_n == NULL)
01094                 return False;
01095 
01096         prs_debug(ps, depth, desc, "srv_io_r_net_share_enum");
01097         depth++;
01098 
01099         if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth))
01100                 return False;
01101 
01102         if(!prs_align(ps))
01103                 return False;
01104 
01105         if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
01106                 return False;
01107 
01108         if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
01109                 return False;
01110 
01111         if(!prs_werror("status", ps, depth, &r_n->status))
01112                 return False;
01113 
01114         return True;
01115 }
01116 
01117 /*******************************************************************
01118  initialises a structure.
01119 ********************************************************************/
01120 
01121 BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level)
01122 {
01123 
01124         uint32 ptr_share_name;
01125 
01126         DEBUG(5,("init_srv_q_net_share_get_info\n"));
01127 
01128         init_buf_unistr2(&q_n->uni_srv_name,   &q_n->ptr_srv_name, srv_name);
01129         init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name,    share_name);
01130 
01131         q_n->info_level = info_level;
01132 
01133         return True;
01134 }
01135 
01136 /*******************************************************************
01137  Reads or writes a structure.
01138 ********************************************************************/
01139 
01140 BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth)
01141 {
01142         if (q_n == NULL)
01143                 return False;
01144 
01145         prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info");
01146         depth++;
01147 
01148         if(!prs_align(ps))
01149                 return False;
01150 
01151         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01152                 return False;
01153         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01154                 return False;
01155 
01156         if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
01157                 return False;
01158 
01159         if(!prs_align(ps))
01160                 return False;
01161 
01162         if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
01163                 return False;
01164 
01165         return True;
01166 }
01167 
01168 /*******************************************************************
01169  Reads or writes a structure.
01170 ********************************************************************/
01171 
01172 static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n)
01173 {
01174         if (r_n == NULL)
01175                 return False;
01176 
01177         prs_debug(ps, depth, desc, "srv_io_srv_share_info");
01178         depth++;
01179 
01180         if(!prs_align(ps))
01181                 return False;
01182 
01183         if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value ))
01184                 return False;
01185 
01186         if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr))
01187                 return False;
01188 
01189         if (r_n->ptr_share_ctr != 0) {
01190                 switch (r_n->switch_value) {
01191                 case 0:
01192                         if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth))
01193                                 return False;
01194 
01195                         /* allow access to pointers in the str part. */
01196                         r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0;
01197 
01198                         if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth))
01199                                 return False;
01200 
01201                         break;
01202                 case 1:
01203                         if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth))
01204                                 return False;
01205 
01206                         /* allow access to pointers in the str part. */
01207                         r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1;
01208 
01209                         if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth))
01210                                 return False;
01211 
01212                         break;
01213                 case 2:
01214                         if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
01215                                 return False;
01216 
01217                         if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
01218                                 return False;
01219 
01220                         break;
01221                 case 501:
01222                         if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth))
01223                                 return False;
01224                         if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth))
01225                                 return False;
01226                         break;
01227 
01228                 case 502:
01229                         if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth))
01230                                 return False;
01231 
01232                         /* allow access to pointers in the str part. */
01233                         r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502;
01234 
01235                         if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth))
01236                                 return False;
01237                         break;
01238                 case 1004:
01239                         if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth))
01240                                 return False;
01241 
01242                         /* allow access to pointers in the str part. */
01243                         r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004;
01244 
01245                         if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth))
01246                                 return False;
01247                         break;
01248                 case 1005:
01249                         if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth))
01250                                 return False;           
01251                         break;
01252                 case 1006:
01253                         if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth))
01254                                 return False;           
01255                         break;
01256                 case 1007:
01257                         if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth))
01258                                 return False;
01259 
01260                         /* allow access to pointers in the str part. */
01261                         r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007;
01262 
01263                         if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth))
01264                                 return False;
01265                         break;
01266                 case 1501:
01267                         if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth))
01268                                 return False;
01269                 default:
01270                         DEBUG(5,("%s no share info at switch_value %d\n",
01271                                  tab_depth(depth), r_n->switch_value));
01272                         break;
01273                 }
01274         }
01275 
01276         return True;
01277 }
01278 
01279 /*******************************************************************
01280  Reads or writes a structure.
01281 ********************************************************************/
01282 
01283 BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth)
01284 {
01285         if (r_n == NULL)
01286                 return False;
01287 
01288         prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info");
01289         depth++;
01290 
01291         if(!prs_align(ps))
01292                 return False;
01293 
01294         if(!srv_io_srv_share_info("info  ", ps, depth, &r_n->info))
01295                 return False;
01296 
01297         if(!prs_align(ps))
01298                 return False;
01299 
01300         if(!prs_werror("status", ps, depth, &r_n->status))
01301                 return False;
01302 
01303         return True;
01304 }
01305 
01306 /*******************************************************************
01307  intialises a structure.
01308 ********************************************************************/
01309 
01310 BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, 
01311                                    const char *srv_name, 
01312                                    const char *share_name, 
01313                                    uint32 info_level, 
01314                                    const SRV_SHARE_INFO *info) 
01315 {
01316 
01317         uint32 ptr_share_name;
01318 
01319         DEBUG(5,("init_srv_q_net_share_set_info\n"));
01320 
01321         init_buf_unistr2(&q_n->uni_srv_name,   &q_n->ptr_srv_name, srv_name);
01322         init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name,    share_name);
01323 
01324         q_n->info_level = info_level;
01325   
01326         q_n->info = *info;
01327 
01328         q_n->ptr_parm_error = 1;
01329         q_n->parm_error     = 0;
01330 
01331         return True;
01332 }
01333 
01334 /*******************************************************************
01335  Reads or writes a structure.
01336 ********************************************************************/
01337 
01338 BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth)
01339 {
01340         if (q_n == NULL)
01341                 return False;
01342 
01343         prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info");
01344         depth++;
01345 
01346         if(!prs_align(ps))
01347                 return False;
01348 
01349         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01350                 return False;
01351         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01352                 return False;
01353 
01354         if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
01355                 return False;
01356 
01357         if(!prs_align(ps))
01358                 return False;
01359 
01360         if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
01361                 return False;
01362 
01363         if(!prs_align(ps))
01364                 return False;
01365 
01366         if(!srv_io_srv_share_info("info  ", ps, depth, &q_n->info))
01367                 return False;
01368 
01369         if(!prs_align(ps))
01370                 return False;
01371         if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error))
01372                 return False;
01373         if(q_n->ptr_parm_error!=0) {
01374                 if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error))
01375                         return False;
01376         }
01377 
01378         return True;
01379 }
01380 
01381 /*******************************************************************
01382  Reads or writes a structure.
01383 ********************************************************************/
01384 
01385 BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth)
01386 {
01387         if (r_n == NULL)
01388                 return False;
01389 
01390         prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info");
01391         depth++;
01392 
01393         if(!prs_align(ps))
01394                 return False;
01395 
01396         if(!prs_uint32("ptr_parm_error  ", ps, depth, &r_n->ptr_parm_error))
01397                 return False;
01398 
01399         if(r_n->ptr_parm_error) {
01400 
01401                 if(!prs_uint32("parm_error  ", ps, depth, &r_n->parm_error))
01402                         return False;
01403         }
01404 
01405         if(!prs_werror("status", ps, depth, &r_n->status))
01406                 return False;
01407 
01408         return True;
01409 }       
01410 
01411 
01412 /*******************************************************************
01413  Reads or writes a structure.
01414 ********************************************************************/
01415 
01416 BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth)
01417 {
01418         if (q_n == NULL)
01419                 return False;
01420 
01421         prs_debug(ps, depth, desc, "srv_io_q_net_share_add");
01422         depth++;
01423 
01424         if(!prs_align(ps))
01425                 return False;
01426 
01427         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01428                 return False;
01429         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01430                 return False;
01431 
01432         if(!prs_align(ps))
01433                 return False;
01434 
01435         if(!prs_uint32("info_level", ps, depth, &q_n->info_level))
01436                 return False;
01437 
01438         if(!prs_align(ps))
01439                 return False;
01440 
01441         if(!srv_io_srv_share_info("info  ", ps, depth, &q_n->info))
01442                 return False;
01443 
01444         if(!prs_align(ps))
01445                 return False;
01446 
01447         if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index))
01448                 return False;
01449         if (q_n->ptr_err_index)
01450                 if (!prs_uint32("err_index", ps, depth, &q_n->err_index))
01451                         return False;
01452 
01453         return True;
01454 }
01455 
01456 void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
01457                               const char *netname, uint32 type, const char *remark, 
01458                               uint32 perms, uint32 max_uses, uint32 num_uses,
01459                               const char *path, const char *passwd, 
01460                               int level, SEC_DESC *sd)
01461 {
01462         switch(level) {
01463         case 502: {
01464                 size_t sd_size = sec_desc_size(sd);
01465                 q->ptr_srv_name = 1;
01466                 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
01467                 q->info.switch_value = q->info_level = level;
01468                 q->info.ptr_share_ctr = 1;
01469                 init_srv_share_info502(&q->info.share.info502.info_502, netname, type,
01470                                      remark, perms, max_uses, num_uses, path, passwd, sd, sd_size);
01471                 init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname,
01472                                          remark, path, passwd, sd, sd_size);
01473                 q->ptr_err_index = 1;
01474                 q->err_index = 0;
01475                 }
01476                 break;
01477         case 2:
01478         default:
01479                 q->ptr_srv_name = 1;
01480                 init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
01481                 q->info.switch_value = q->info_level = level;
01482                 q->info.ptr_share_ctr = 1;
01483                 init_srv_share_info2(&q->info.share.info2.info_2, netname, type,
01484                                      remark, perms, max_uses, num_uses, path, passwd);
01485                 init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname,
01486                                          remark, path, passwd);
01487                 q->ptr_err_index = 1;
01488                 q->err_index = 0;
01489                 break;
01490         }
01491 }
01492 
01493 
01494 /*******************************************************************
01495  Reads or writes a structure.
01496 ********************************************************************/
01497 
01498 BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth)
01499 {
01500         if (r_n == NULL)
01501                 return False;
01502 
01503         prs_debug(ps, depth, desc, "srv_io_r_net_share_add");
01504         depth++;
01505 
01506         if(!prs_align(ps))
01507                 return False;
01508 
01509         if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error))
01510                 return False;
01511 
01512         if(r_n->ptr_parm_error) {
01513           
01514                 if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error))
01515                         return False;
01516         }
01517 
01518         if(!prs_werror("status", ps, depth, &r_n->status))
01519                 return False;
01520 
01521         return True;
01522 }       
01523 
01524 /*******************************************************************
01525  initialises a structure.
01526 ********************************************************************/
01527 
01528 void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname,
01529                               const char *sharename)
01530 {
01531         del->ptr_srv_name = 1;
01532         init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE);
01533         init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE);
01534 }
01535 
01536 /*******************************************************************
01537  Reads or writes a structure.
01538 ********************************************************************/
01539 
01540 BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
01541 {
01542         if (q_n == NULL)
01543                 return False;
01544 
01545         prs_debug(ps, depth, desc, "srv_io_q_net_share_del");
01546         depth++;
01547 
01548         if(!prs_align(ps))
01549                 return False;
01550 
01551         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01552                 return False;
01553         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01554                 return False;
01555 
01556         if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth))
01557                 return False;
01558 
01559         if(!prs_align(ps))
01560                 return False;
01561         if(!prs_uint32("reserved", ps, depth, &q_n->reserved))
01562                 return False;
01563 
01564         return True;
01565 }
01566 
01567 /*******************************************************************
01568  Reads or writes a structure.
01569 ********************************************************************/
01570 
01571 BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth)
01572 {
01573         if (q_n == NULL)
01574                 return False;
01575 
01576         prs_debug(ps, depth, desc, "srv_io_r_net_share_del");
01577         depth++;
01578 
01579         if(!prs_align(ps))
01580                 return False;
01581 
01582         if(!prs_werror("status", ps, depth, &q_n->status))
01583                 return False;
01584 
01585         return True;
01586 }       
01587 
01588 /*******************************************************************
01589  Inits a SESS_INFO_0_STR structure
01590 ********************************************************************/
01591 
01592 void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name )
01593 {
01594         ZERO_STRUCTP( ss0 );
01595 
01596         if ( name ) {
01597                 if ( (ss0->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) {
01598                         DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
01599                         return;
01600                 }
01601                 init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE );
01602         }
01603 }
01604 
01605 /*******************************************************************
01606  Reads or writes a structure.
01607 ********************************************************************/
01608 
01609 static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth)
01610 {
01611         if (ss0 == NULL)
01612                 return False;
01613 
01614         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0");
01615         depth++;
01616 
01617         if(!prs_align(ps))
01618                 return False;
01619 
01620         if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
01621                 return False;
01622         if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info))
01623                 return False;
01624 
01625         if (ss0->ptr_sess_info != 0) {
01626                 uint32 i;
01627                 uint32 num_entries = ss0->num_entries_read;
01628 
01629                 if (num_entries > MAX_SESS_ENTRIES) {
01630                         num_entries = MAX_SESS_ENTRIES; /* report this! */
01631                 }
01632 
01633                 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
01634                         return False;
01635 
01636                 SMB_ASSERT_ARRAY(ss0->info_0, num_entries);
01637 
01638                 /* first the pointers */
01639                 for (i = 0; i < num_entries; i++) {
01640                         if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) )
01641                                 return False;
01642                 }
01643 
01644                 /* now the strings */
01645                 for (i = 0; i < num_entries; i++) {
01646                         if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename ))
01647                                 return False;
01648                 }
01649 
01650                 if(!prs_align(ps))
01651                         return False;
01652         }
01653 
01654         return True;
01655 }
01656 
01657 /*******************************************************************
01658  Inits a SESS_INFO_1 structure
01659 ********************************************************************/
01660 
01661 void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user,
01662                           uint32 num_opens, uint32 open_time, uint32 idle_time,
01663                           uint32 user_flags)
01664 {
01665         DEBUG(5,("init_srv_sess_info1: %s\n", name));
01666 
01667         ZERO_STRUCTP( ss1 );
01668 
01669         if ( name ) {
01670                 if ( (ss1->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) {
01671                         DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
01672                         return;
01673                 }
01674                 init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE );
01675         }
01676 
01677         if ( user ) {
01678                 if ( (ss1->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) {
01679                         DEBUG(0,("init_srv_sess_info0: talloc failed!\n"));
01680                         return;
01681                 }
01682                 init_unistr2( ss1->username, user, UNI_STR_TERMINATE );
01683         }
01684 
01685         ss1->num_opens  = num_opens;
01686         ss1->open_time  = open_time;
01687         ss1->idle_time  = idle_time;
01688         ss1->user_flags = user_flags;
01689 }
01690 
01691 
01692 /*******************************************************************
01693  Reads or writes a structure.
01694 ********************************************************************/
01695 
01696 static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth)
01697 {
01698         if (ss1 == NULL)
01699                 return False;
01700 
01701         prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1");
01702         depth++;
01703 
01704         if(!prs_align(ps))
01705                 return False;
01706 
01707         if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
01708                 return False;
01709         if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info))
01710                 return False;
01711 
01712         if (ss1->ptr_sess_info != 0) {
01713                 uint32 i;
01714                 uint32 num_entries = ss1->num_entries_read;
01715 
01716                 if (num_entries > MAX_SESS_ENTRIES) {
01717                         num_entries = MAX_SESS_ENTRIES; /* report this! */
01718                 }
01719 
01720                 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
01721                         return False;
01722 
01723                 SMB_ASSERT_ARRAY(ss1->info_1, num_entries);
01724 
01725                 /* first the pointers and flags */
01726 
01727                 for (i = 0; i < num_entries; i++) {
01728 
01729                         if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename ))
01730                                 return False;
01731                         if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username ))
01732                                 return False;
01733 
01734                         if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens))
01735                                 return False;
01736                         if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time))
01737                                 return False;
01738                         if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time))
01739                                 return False;
01740                         if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags))
01741                                 return False;
01742                 }
01743 
01744                 /* now the strings */
01745 
01746                 for (i = 0; i < num_entries; i++) {
01747                         if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename ))
01748                                 return False;
01749                         if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username ))
01750                                 return False;
01751                 }
01752 
01753                 if(!prs_align(ps))
01754                         return False;
01755         }
01756 
01757         return True;
01758 }
01759 
01760 /*******************************************************************
01761  Reads or writes a structure.
01762 ********************************************************************/
01763 
01764 static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
01765 {
01766         SRV_SESS_INFO_CTR *ctr = *pp_ctr;
01767 
01768         prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr");
01769         depth++;
01770 
01771         if(UNMARSHALLING(ps)) {
01772                 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1);
01773                 if (ctr == NULL)
01774                         return False;
01775         }
01776 
01777         if (ctr == NULL)
01778                 return False;
01779 
01780         if(!prs_align(ps))
01781                 return False;
01782 
01783         if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
01784                 return False;
01785         if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr))
01786                 return False;
01787 
01788         if (ctr->ptr_sess_ctr != 0) {
01789                 switch (ctr->switch_value) {
01790                 case 0:
01791                         if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth))
01792                                 return False;
01793                         break;
01794                 case 1:
01795                         if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth))
01796                                 return False;
01797                         break;
01798                 default:
01799                         DEBUG(5,("%s no session info at switch_value %d\n",
01800                                  tab_depth(depth), ctr->switch_value));
01801                         break;
01802                 }
01803         }
01804 
01805         return True;
01806 }
01807 
01808 /*******************************************************************
01809  Reads or writes a structure.
01810 ********************************************************************/
01811 
01812 BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth)
01813 {
01814         if (q_u == NULL)
01815                 return False;
01816 
01817         prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum");
01818         depth++;
01819 
01820         if(!prs_align(ps))
01821                 return False;
01822 
01823         if(!prs_pointer("servername", ps, depth, (void**)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
01824                 return False;
01825 
01826         if(!prs_align(ps))
01827                 return False;
01828 
01829         if(!prs_pointer("qualifier", ps, depth, (void**)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
01830                 return False;
01831 
01832         if(!prs_align(ps))
01833                 return False;
01834 
01835         if(!prs_pointer("username", ps, depth, (void**)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
01836                 return False;
01837 
01838         if(!prs_align(ps))
01839                 return False;
01840 
01841         if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level))
01842                 return False;
01843         
01844         if (q_u->sess_level != (uint32)-1) {
01845                 if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth))
01846                         return False;
01847         }
01848 
01849         if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
01850                 return False;
01851 
01852         if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
01853                 return False;
01854 
01855         return True;
01856 }
01857 
01858 /*******************************************************************
01859  Reads or writes a structure.
01860 ********************************************************************/
01861 
01862 BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth)
01863 {
01864         if (r_n == NULL)
01865                 return False;
01866 
01867         prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum");
01868         depth++;
01869 
01870         if(!prs_align(ps))
01871                 return False;
01872 
01873         if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level))
01874                 return False;
01875 
01876         if (r_n->sess_level != (uint32)-1) {
01877                 if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth))
01878                         return False;
01879         }
01880 
01881         if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
01882                 return False;
01883         if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
01884                 return False;
01885         if(!prs_werror("status", ps, depth, &r_n->status))
01886                 return False;
01887 
01888         return True;
01889 }
01890 
01891 /*******************************************************************
01892  Inits a SRV_Q_NET_SESS_DEL structure.
01893 ********************************************************************/
01894 
01895 void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name,
01896                               const char *cli_name, const char *user_name)
01897 {
01898         DEBUG(5,("init_q_net_sess_enum\n"));
01899 
01900         init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
01901         init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name);
01902         init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name);
01903 }
01904 
01905 /*******************************************************************
01906  Reads or writes a structure.
01907 ********************************************************************/
01908 
01909 BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth)
01910 {
01911         if (q_n == NULL)
01912                 return False;
01913 
01914         prs_debug(ps, depth, desc, "srv_io_q_net_sess_del");
01915         depth++;
01916 
01917         if(!prs_align(ps))
01918                 return False;
01919 
01920         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
01921                 return False;
01922         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
01923                 return False;
01924 
01925         if(!prs_align(ps))
01926                 return False;
01927 
01928         if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name))
01929                 return False;
01930         if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth))
01931                 return False;
01932 
01933         if(!prs_align(ps))
01934                 return False;
01935         if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name))
01936                 return False;
01937         if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth))
01938                 return False;
01939 
01940         return True;
01941 }
01942 
01943 /*******************************************************************
01944  Reads or writes a structure.
01945 ********************************************************************/
01946 
01947 BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth)
01948 {
01949         if (r_n == NULL)
01950                 return False;
01951 
01952         prs_debug(ps, depth, desc, "srv_io_r_net_sess_del");
01953         depth++;
01954 
01955         if(!prs_align(ps))
01956                 return False;
01957 
01958         if(!prs_werror("status", ps, depth, &r_n->status))
01959                 return False;
01960 
01961         return True;
01962 }
01963 
01964 /*******************************************************************
01965  Inits a CONN_INFO_0 structure
01966 ********************************************************************/
01967 
01968 void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id)
01969 {
01970         DEBUG(5,("init_srv_conn_info0\n"));
01971 
01972         ss0->id = id;
01973 }
01974 
01975 /*******************************************************************
01976  Reads or writes a structure.
01977 ********************************************************************/
01978 
01979 static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth)
01980 {
01981         if (ss0 == NULL)
01982                 return False;
01983 
01984         prs_debug(ps, depth, desc, "srv_io_conn_info0");
01985         depth++;
01986 
01987         if(!prs_align(ps))
01988                 return False;
01989 
01990         if(!prs_uint32("id", ps, depth, &ss0->id))
01991                 return False;
01992 
01993         return True;
01994 }
01995 
01996 /*******************************************************************
01997  Reads or writes a structure.
01998 ********************************************************************/
01999 
02000 static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth)
02001 {
02002         if (ss0 == NULL)
02003                 return False;
02004 
02005         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0");
02006         depth++;
02007 
02008         if(!prs_align(ps))
02009                 return False;
02010 
02011         if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read))
02012                 return False;
02013         if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info))
02014                 return False;
02015 
02016         if (ss0->ptr_conn_info != 0) {
02017                 int i;
02018                 int num_entries = ss0->num_entries_read;
02019 
02020                 if (num_entries > MAX_CONN_ENTRIES) {
02021                         num_entries = MAX_CONN_ENTRIES; /* report this! */
02022                 }
02023 
02024                 if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2))
02025                         return False;
02026 
02027                 for (i = 0; i < num_entries; i++) {
02028                         if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth))
02029                                 return False;
02030                 }
02031 
02032                 if(!prs_align(ps))
02033                         return False;
02034         }
02035 
02036         return True;
02037 }
02038 
02039 /*******************************************************************
02040  Inits a CONN_INFO_1_STR structure
02041 ********************************************************************/
02042 
02043 void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name)
02044 {
02045         DEBUG(5,("init_srv_conn_info1_str\n"));
02046 
02047         init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE);
02048         init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE);
02049 }
02050 
02051 /*******************************************************************
02052  Reads or writes a structure.
02053 ********************************************************************/
02054 
02055 static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth)
02056 {
02057         if (ss1 == NULL)
02058                 return False;
02059 
02060         prs_debug(ps, depth, desc, "srv_io_conn_info1_str");
02061         depth++;
02062 
02063         if(!prs_align(ps))
02064                 return False;
02065 
02066         if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth))
02067                 return False;
02068         if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth))
02069                 return False;
02070 
02071         return True;
02072 }
02073 
02074 /*******************************************************************
02075  Inits a CONN_INFO_1 structure
02076 ********************************************************************/
02077 
02078 void init_srv_conn_info1(CONN_INFO_1 *ss1, 
02079                                 uint32 id, uint32 type,
02080                                 uint32 num_opens, uint32 num_users, uint32 open_time,
02081                                 const char *usr_name, const char *net_name)
02082 {
02083         DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name));
02084 
02085         ss1->id        = id       ;
02086         ss1->type      = type     ;
02087         ss1->num_opens = num_opens ;
02088         ss1->num_users = num_users;
02089         ss1->open_time = open_time;
02090 
02091         ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0;
02092         ss1->ptr_net_name = (net_name != NULL) ? 1 : 0;
02093 }
02094 
02095 /*******************************************************************
02096  Reads or writes a structure.
02097 ********************************************************************/
02098 
02099 static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth)
02100 {
02101         if (ss1 == NULL)
02102                 return False;
02103 
02104         prs_debug(ps, depth, desc, "srv_io_conn_info1");
02105         depth++;
02106 
02107         if(!prs_align(ps))
02108                 return False;
02109 
02110         if(!prs_uint32("id          ", ps, depth, &ss1->id))
02111                 return False;
02112         if(!prs_uint32("type        ", ps, depth, &ss1->type))
02113                 return False;
02114         if(!prs_uint32("num_opens   ", ps, depth, &ss1->num_opens))
02115                 return False;
02116         if(!prs_uint32("num_users   ", ps, depth, &ss1->num_users))
02117                 return False;
02118         if(!prs_uint32("open_time   ", ps, depth, &ss1->open_time))
02119                 return False;
02120 
02121         if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name))
02122                 return False;
02123         if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name))
02124                 return False;
02125 
02126         return True;
02127 }
02128 
02129 /*******************************************************************
02130  Reads or writes a structure.
02131 ********************************************************************/
02132 
02133 static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth)
02134 {
02135         if (ss1 == NULL)
02136                 return False;
02137 
02138         prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1");
02139         depth++;
02140 
02141         if(!prs_align(ps))
02142                 return False;
02143 
02144         if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read))
02145                 return False;
02146         if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info))
02147                 return False;
02148 
02149         if (ss1->ptr_conn_info != 0) {
02150                 int i;
02151                 int num_entries = ss1->num_entries_read;
02152 
02153                 if (num_entries > MAX_CONN_ENTRIES) {
02154                         num_entries = MAX_CONN_ENTRIES; /* report this! */
02155                 }
02156 
02157                 if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2))
02158                         return False;
02159 
02160                 for (i = 0; i < num_entries; i++) {
02161                         if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth))
02162                                 return False;
02163                 }
02164 
02165                 for (i = 0; i < num_entries; i++) {
02166                         if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth))
02167                                 return False;
02168                 }
02169 
02170                 if(!prs_align(ps))
02171                         return False;
02172         }
02173 
02174         return True;
02175 }
02176 
02177 /*******************************************************************
02178  Reads or writes a structure.
02179 ********************************************************************/
02180 
02181 static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
02182 {
02183         SRV_CONN_INFO_CTR *ctr = *pp_ctr;
02184 
02185         prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr");
02186         depth++;
02187 
02188         if (UNMARSHALLING(ps)) {
02189                 ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1);
02190                 if (ctr == NULL)
02191                         return False;
02192         }
02193                 
02194         if (ctr == NULL)
02195                 return False;
02196 
02197         if(!prs_align(ps))
02198                 return False;
02199 
02200         if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
02201                 return False;
02202         if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr))
02203                 return False;
02204 
02205         if (ctr->ptr_conn_ctr != 0) {
02206                 switch (ctr->switch_value) {
02207                 case 0:
02208                         if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth))
02209                                 return False;
02210                         break;
02211                 case 1:
02212                         if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth))
02213                                 return False;
02214                         break;
02215                 default:
02216                         DEBUG(5,("%s no connection info at switch_value %d\n",
02217                                  tab_depth(depth), ctr->switch_value));
02218                         break;
02219                 }
02220         }
02221 
02222         return True;
02223 }
02224 
02225 /*******************************************************************
02226   Reads or writes a structure.
02227 ********************************************************************/
02228 
02229 void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, 
02230                                 const char *srv_name, const char *qual_name,
02231                                 uint32 conn_level, SRV_CONN_INFO_CTR *ctr,
02232                                 uint32 preferred_len,
02233                                 ENUM_HND *hnd)
02234 {
02235         DEBUG(5,("init_q_net_conn_enum\n"));
02236 
02237         q_n->ctr = ctr;
02238 
02239         init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name );
02240         init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name);
02241 
02242         q_n->conn_level    = conn_level;
02243         q_n->preferred_len = preferred_len;
02244 
02245         memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
02246 }
02247 
02248 /*******************************************************************
02249  Reads or writes a structure.
02250 ********************************************************************/
02251 
02252 BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth)
02253 {
02254         if (q_n == NULL)
02255                 return False;
02256 
02257         prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum");
02258         depth++;
02259 
02260         if(!prs_align(ps))
02261                 return False;
02262 
02263         if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name))
02264                 return False;
02265         if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth))
02266                 return False;
02267 
02268         if(!prs_align(ps))
02269                 return False;
02270 
02271         if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
02272                 return False;
02273         if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth))
02274                 return False;
02275 
02276         if(!prs_align(ps))
02277                 return False;
02278 
02279         if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level))
02280                 return False;
02281         
02282         if (q_n->conn_level != (uint32)-1) {
02283                 if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth))
02284                         return False;
02285         }
02286 
02287         if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
02288                 return False;
02289 
02290         if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
02291                 return False;
02292 
02293         return True;
02294 }
02295 
02296 /*******************************************************************
02297  Reads or writes a structure.
02298 ********************************************************************/
02299 
02300 BOOL srv_io_r_net_conn_enum(const char *desc,  SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth)
02301 {
02302         if (r_n == NULL)
02303                 return False;
02304 
02305         prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum");
02306         depth++;
02307 
02308         if(!prs_align(ps))
02309                 return False;
02310 
02311         if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level))
02312                 return False;
02313 
02314         if (r_n->conn_level != (uint32)-1) {
02315                 if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth))
02316                         return False;
02317         }
02318 
02319         if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
02320                 return False;
02321         if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
02322                 return False;
02323         if(!prs_werror("status", ps, depth, &r_n->status))
02324                 return False;
02325 
02326         return True;
02327 }
02328 
02329 /*******************************************************************
02330  Reads or writes a structure.
02331 ********************************************************************/
02332 
02333 static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth)
02334 {
02335         if (sh1 == NULL)
02336                 return False;
02337 
02338         prs_debug(ps, depth, desc, "srv_io_file_info3_str");
02339         depth++;
02340 
02341         if(!prs_align(ps))
02342                 return False;
02343 
02344         if ( sh1->path ) {
02345                 if(!smb_io_unistr2("", sh1->path, True, ps, depth))
02346                         return False;
02347         }
02348 
02349         if ( sh1->user ) {
02350                 if(!smb_io_unistr2("", sh1->user, True, ps, depth))
02351                         return False;
02352         }
02353 
02354         return True;
02355 }
02356 
02357 /*******************************************************************
02358  Inits a FILE_INFO_3 structure
02359 ********************************************************************/
02360 
02361 void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks,
02362                           const char *user_name, const char *path_name )
02363 {
02364         fl3->id        = id;    
02365         fl3->perms     = perms;
02366         fl3->num_locks = num_locks;
02367 
02368         if ( path_name ) {
02369                 if ( (fl3->path = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL )
02370                         return;
02371                 init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE);
02372         }
02373 
02374         if ( user_name ) {
02375                 if ( (fl3->user = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL )
02376                         return;
02377                 init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE);
02378         }
02379 
02380         return;
02381 }
02382 
02383 /*******************************************************************
02384  Reads or writes a structure.
02385 ********************************************************************/
02386 
02387 static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth)
02388 {
02389         uint32 uni_p;
02390 
02391         if (fl3 == NULL)
02392                 return False;
02393 
02394         prs_debug(ps, depth, desc, "srv_io_file_info3");
02395         depth++;
02396 
02397         if(!prs_align(ps))
02398                 return False;
02399 
02400         if(!prs_uint32("id           ", ps, depth, &fl3->id))
02401                 return False;
02402         if(!prs_uint32("perms        ", ps, depth, &fl3->perms))
02403                 return False;
02404         if(!prs_uint32("num_locks    ", ps, depth, &fl3->num_locks))
02405                 return False;
02406 
02407         uni_p = fl3->path ? 1 : 0;
02408         if(!prs_uint32("ptr", ps, depth, &uni_p))
02409                 return False;
02410         if (UNMARSHALLING(ps)) {
02411                 if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
02412                         return False;
02413                 }
02414         }
02415 
02416         uni_p = fl3->user ? 1 : 0;
02417         if(!prs_uint32("ptr", ps, depth, &uni_p))
02418                 return False;
02419         if (UNMARSHALLING(ps)) {
02420                 if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) {
02421                         return False;
02422                 }
02423         }
02424 
02425         return True;
02426 }
02427 
02428 /*******************************************************************
02429  Reads or writes a structure.
02430 ********************************************************************/
02431 
02432 static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth)
02433 {
02434         if (ctr == NULL)
02435                 return False;
02436 
02437         prs_debug(ps, depth, desc, "srv_io_srv_file_ctr");
02438         depth++;
02439 
02440         if (UNMARSHALLING(ps)) {
02441                 ZERO_STRUCTP(ctr);
02442         }
02443 
02444         if(!prs_align(ps))
02445                 return False;
02446 
02447         if(!prs_uint32("level", ps, depth, &ctr->level))
02448                 return False;
02449 
02450         if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info))
02451                 return False;
02452         if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries))
02453                 return False;
02454         if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries))
02455                 return False;
02456 
02457         if (ctr->ptr_entries == 0)
02458                 return True;
02459 
02460         if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2))
02461                 return False;
02462 
02463         switch (ctr->level) {
02464         case 3: {
02465                 FILE_INFO_3 *info3 = ctr->file.info3;
02466                 int num_entries = ctr->num_entries;
02467                 int i;
02468 
02469                 if (UNMARSHALLING(ps) && num_entries) {
02470                         if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries)))
02471                                 return False;
02472                         ctr->file.info3 = info3;
02473                 }
02474 
02475                 for (i = 0; i < num_entries; i++) {
02476                         if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) 
02477                                 return False;
02478                 }
02479 
02480                 for (i = 0; i < num_entries; i++) {
02481                         if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth))
02482                                 return False;
02483                 }
02484                 break;
02485         }
02486         default:
02487                 DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level));
02488                 break;
02489         }
02490                         
02491         return True;
02492 }
02493 
02494 /*******************************************************************
02495  Inits a SRV_Q_NET_FILE_ENUM structure.
02496 ********************************************************************/
02497 
02498 void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, 
02499                               const char *srv_name, const char *qual_name, 
02500                               const char *user_name,
02501                               uint32 file_level, SRV_FILE_INFO_CTR *ctr,
02502                               uint32 preferred_len,
02503                               ENUM_HND *hnd)
02504 {
02505         uint32 ptr;
02506 
02507         if ( srv_name ) {
02508                 if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL )
02509                         return;
02510                 init_buf_unistr2(q_n->servername, &ptr, srv_name);
02511         }
02512 
02513         if ( qual_name ) {
02514                 if ( (q_n->qualifier = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL )
02515                         return;
02516                 init_buf_unistr2(q_n->qualifier,  &ptr, qual_name);
02517         }
02518 
02519         if ( user_name ) {
02520                 if ( (q_n->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL )
02521                         return;
02522                 init_buf_unistr2(q_n->username,   &ptr, user_name);
02523         }
02524 
02525         q_n->level = q_n->ctr.level = file_level;
02526 
02527         q_n->preferred_len = preferred_len;
02528         q_n->ctr.ptr_file_info = 1;
02529         q_n->ctr.num_entries = 0;
02530         q_n->ctr.num_entries2 = 0;
02531 
02532         memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd));
02533 }
02534 
02535 /*******************************************************************
02536  Reads or writes a structure.
02537 ********************************************************************/
02538 
02539 BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth)
02540 {
02541         if (q_u == NULL)
02542                 return False;
02543 
02544         prs_debug(ps, depth, desc, "srv_io_q_net_file_enum");
02545         depth++;
02546 
02547         if(!prs_align(ps))
02548                 return False;
02549 
02550         if(!prs_pointer("servername", ps, depth, (void**)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
02551                 return False;
02552         if(!prs_align(ps))
02553                 return False;
02554 
02555         if(!prs_pointer("qualifier", ps, depth, (void**)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
02556                 return False;
02557         if(!prs_align(ps))
02558                 return False;
02559 
02560         if(!prs_pointer("username", ps, depth, (void**)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
02561                 return False;
02562         if(!prs_align(ps))
02563                 return False;
02564 
02565         if(!prs_uint32("level", ps, depth, &q_u->level))
02566                 return False;
02567 
02568         if (q_u->level != (uint32)-1) {
02569                 if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth))
02570                         return False;
02571         }
02572 
02573         if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len))
02574                 return False;
02575 
02576         if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth))
02577                 return False;
02578 
02579         return True;
02580 }
02581 
02582 /*******************************************************************
02583  Reads or writes a structure.
02584 ********************************************************************/
02585 
02586 BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth)
02587 {
02588         if (r_n == NULL)
02589                 return False;
02590 
02591         prs_debug(ps, depth, desc, "srv_io_r_net_file_enum");
02592         depth++;
02593 
02594         if(!prs_align(ps))
02595                 return False;
02596 
02597         if(!prs_uint32("level", ps, depth, &r_n->level))
02598                 return False;
02599 
02600         if (r_n->level != 0) {
02601                 if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth))
02602                         return False;
02603         }
02604 
02605         if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
02606                 return False;
02607         if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
02608                 return False;
02609         if(!prs_werror("status", ps, depth, &r_n->status))
02610                 return False;
02611 
02612         return True;
02613 }
02614 
02615 /*******************************************************************
02616  Initialize a net file close request
02617 ********************************************************************/
02618 void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server,
02619                                uint32 file_id)
02620 {
02621         if ( server ) {
02622                 if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) {
02623                         return;
02624                 }
02625                 init_unistr2(q_n->servername, server, UNI_STR_TERMINATE);
02626         }
02627 
02628         q_n->file_id = file_id;
02629 }
02630 
02631 /*******************************************************************
02632  Inits a SRV_INFO_100 structure.
02633  ********************************************************************/
02634 
02635 void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name)
02636 {
02637         DEBUG(5,("init_srv_info_100\n"));
02638 
02639         sv100->platform_id  = platform_id;
02640         init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name);
02641 }
02642 
02643 /*******************************************************************
02644  Reads or writes a SRV_INFO_101 structure.
02645  ********************************************************************/
02646 
02647 static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth)
02648 {
02649         if (sv100 == NULL)
02650                 return False;
02651 
02652         prs_debug(ps, depth, desc, "srv_io_info_100");
02653         depth++;
02654 
02655         if(!prs_align(ps))
02656                 return False;
02657 
02658         if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id))
02659                 return False;
02660         if(!prs_uint32("ptr_name    ", ps, depth, &sv100->ptr_name))
02661                 return False;
02662 
02663         if(!smb_io_unistr2("uni_name    ", &sv100->uni_name, True, ps, depth))
02664                 return False;
02665 
02666         return True;
02667 }
02668 
02669 
02670 /*******************************************************************
02671  Inits a SRV_INFO_101 structure.
02672  ********************************************************************/
02673 
02674 void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name,
02675                                 uint32 ver_major, uint32 ver_minor,
02676                                 uint32 srv_type, const char *comment)
02677 {
02678         DEBUG(5,("init_srv_info_101\n"));
02679 
02680         sv101->platform_id  = platform_id;
02681         init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name);
02682         sv101->ver_major    = ver_major;
02683         sv101->ver_minor    = ver_minor;
02684         sv101->srv_type     = srv_type;
02685         init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment);
02686 }
02687 
02688 /*******************************************************************
02689  Reads or writes a SRV_INFO_101 structure.
02690  ********************************************************************/
02691 
02692 static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth)
02693 {
02694         if (sv101 == NULL)
02695                 return False;
02696 
02697         prs_debug(ps, depth, desc, "srv_io_info_101");
02698         depth++;
02699 
02700         if(!prs_align(ps))
02701                 return False;
02702 
02703         if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id))
02704                 return False;
02705         if(!prs_uint32("ptr_name    ", ps, depth, &sv101->ptr_name))
02706                 return False;
02707         if(!prs_uint32("ver_major   ", ps, depth, &sv101->ver_major))
02708                 return False;
02709         if(!prs_uint32("ver_minor   ", ps, depth, &sv101->ver_minor))
02710                 return False;
02711         if(!prs_uint32("srv_type    ", ps, depth, &sv101->srv_type))
02712                 return False;
02713         if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment))
02714                 return False;
02715 
02716         if(!prs_align(ps))
02717                 return False;
02718 
02719         if(!smb_io_unistr2("uni_name    ", &sv101->uni_name, True, ps, depth))
02720                 return False;
02721         if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth))
02722                 return False;
02723 
02724         return True;
02725 }
02726 
02727 /*******************************************************************
02728  Inits a SRV_INFO_102 structure.
02729  ********************************************************************/
02730 
02731 void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name,
02732                                 const char *comment, uint32 ver_major, uint32 ver_minor,
02733                                 uint32 srv_type, uint32 users, uint32 disc, uint32 hidden,
02734                                 uint32 announce, uint32 ann_delta, uint32 licenses,
02735                                 const char *usr_path)
02736 {
02737         DEBUG(5,("init_srv_info_102\n"));
02738 
02739         sv102->platform_id  = platform_id;
02740         init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name);
02741         sv102->ver_major    = ver_major;
02742         sv102->ver_minor    = ver_minor;
02743         sv102->srv_type     = srv_type;
02744         init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment);
02745 
02746         /* same as 101 up to here */
02747 
02748         sv102->users        = users;
02749         sv102->disc         = disc;
02750         sv102->hidden       = hidden;
02751         sv102->announce     = announce;
02752         sv102->ann_delta    = ann_delta;
02753         sv102->licenses     = licenses;
02754         init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path);
02755 }
02756 
02757 
02758 /*******************************************************************
02759  Reads or writes a SRV_INFO_102 structure.
02760  ********************************************************************/
02761 
02762 static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth)
02763 {
02764         if (sv102 == NULL)
02765                 return False;
02766 
02767         prs_debug(ps, depth, desc, "srv_io_info102");
02768         depth++;
02769 
02770         if(!prs_align(ps))
02771                 return False;
02772 
02773         if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id))
02774                 return False;
02775         if(!prs_uint32("ptr_name    ", ps, depth, &sv102->ptr_name))
02776                 return False;
02777         if(!prs_uint32("ver_major   ", ps, depth, &sv102->ver_major))
02778                 return False;
02779         if(!prs_uint32("ver_minor   ", ps, depth, &sv102->ver_minor))
02780                 return False;
02781         if(!prs_uint32("srv_type    ", ps, depth, &sv102->srv_type))
02782                 return False;
02783         if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment))
02784                 return False;
02785 
02786         /* same as 101 up to here */
02787 
02788         if(!prs_uint32("users       ", ps, depth, &sv102->users))
02789                 return False;
02790         if(!prs_uint32("disc        ", ps, depth, &sv102->disc))
02791                 return False;
02792         if(!prs_uint32("hidden      ", ps, depth, &sv102->hidden))
02793                 return False;
02794         if(!prs_uint32("announce    ", ps, depth, &sv102->announce))
02795                 return False;
02796         if(!prs_uint32("ann_delta   ", ps, depth, &sv102->ann_delta))
02797                 return False;
02798         if(!prs_uint32("licenses    ", ps, depth, &sv102->licenses))
02799                 return False;
02800         if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path))
02801                 return False;
02802 
02803         if(!smb_io_unistr2("uni_name    ", &sv102->uni_name, True, ps, depth))
02804                 return False;
02805         if(!prs_align(ps))
02806                 return False;
02807         if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth))
02808                 return False;
02809         if(!prs_align(ps))
02810                 return False;
02811         if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth))
02812                 return False;
02813 
02814         return True;
02815 }
02816 
02817 /*******************************************************************
02818  Reads or writes a SRV_INFO_102 structure.
02819  ********************************************************************/
02820 
02821 static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth)
02822 {
02823         if (ctr == NULL)
02824                 return False;
02825 
02826         prs_debug(ps, depth, desc, "srv_io_info_ctr");
02827         depth++;
02828 
02829         if(!prs_align(ps))
02830                 return False;
02831 
02832         if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value))
02833                 return False;
02834         if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr))
02835                 return False;
02836 
02837         if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) {
02838                 switch (ctr->switch_value) {
02839                 case 100:
02840                         if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth))
02841                                 return False;
02842                         break;
02843                 case 101:
02844                         if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth))
02845                                 return False;
02846                         break;
02847                 case 102:
02848                         if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth))
02849                                 return False;
02850                         break;
02851                 default:
02852                         DEBUG(5,("%s no server info at switch_value %d\n",
02853                                          tab_depth(depth), ctr->switch_value));
02854                         break;
02855                 }
02856                 if(!prs_align(ps))
02857                         return False;
02858         }
02859 
02860         return True;
02861 }
02862 
02863 /*******************************************************************
02864  Inits a SRV_Q_NET_SRV_GET_INFO structure.
02865  ********************************************************************/
02866 
02867 void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv,
02868                                 const char *server_name, uint32 switch_value)
02869 {
02870         DEBUG(5,("init_srv_q_net_srv_get_info\n"));
02871 
02872         init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name);
02873 
02874         srv->switch_value = switch_value;
02875 }
02876 
02877 /*******************************************************************
02878  Reads or writes a structure.
02879 ********************************************************************/
02880 
02881 BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth)
02882 {
02883         if (q_n == NULL)
02884                 return False;
02885 
02886         prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info");
02887         depth++;
02888 
02889         if(!prs_align(ps))
02890                 return False;
02891 
02892         if(!prs_uint32("ptr_srv_name  ", ps, depth, &q_n->ptr_srv_name))
02893                 return False;
02894         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
02895                 return False;
02896 
02897         if(!prs_align(ps))
02898                 return False;
02899 
02900         if(!prs_uint32("switch_value  ", ps, depth, &q_n->switch_value))
02901                 return False;
02902 
02903         return True;
02904 }
02905 
02906 /*******************************************************************
02907  Inits a SRV_R_NET_SRV_GET_INFO structure.
02908  ********************************************************************/
02909 
02910 void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
02911                                 uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
02912 {
02913         DEBUG(5,("init_srv_r_net_srv_get_info\n"));
02914 
02915         srv->ctr = ctr;
02916 
02917         if (W_ERROR_IS_OK(status)) {
02918                 srv->ctr->switch_value = switch_value;
02919                 srv->ctr->ptr_srv_ctr  = 1;
02920         } else {
02921                 srv->ctr->switch_value = 0;
02922                 srv->ctr->ptr_srv_ctr  = 0;
02923         }
02924 
02925         srv->status = status;
02926 }
02927 
02928 /*******************************************************************
02929  Inits a SRV_R_NET_SRV_SET_INFO structure.
02930  ********************************************************************/
02931 
02932 void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
02933                                  uint32 switch_value, WERROR status)
02934 {
02935         DEBUG(5,("init_srv_r_net_srv_set_info\n"));
02936 
02937         srv->switch_value = switch_value;
02938         srv->status = status;
02939 }
02940 
02941 /*******************************************************************
02942  Reads or writes a structure.
02943 ********************************************************************/
02944 
02945 BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, 
02946                                prs_struct *ps, int depth)
02947 {
02948         prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info");
02949         depth++;
02950 
02951         if(!prs_align(ps))
02952                 return False;
02953 
02954         if(!prs_uint32("ptr_srv_name  ", ps, depth, &q_n->ptr_srv_name))
02955                 return False;
02956         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
02957                 return False;
02958 
02959         if(!prs_align(ps))
02960                 return False;
02961 
02962         if(!prs_uint32("switch_value  ", ps, depth, &q_n->switch_value))
02963                 return False;
02964 
02965         if (UNMARSHALLING(ps)) {
02966                 q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1);
02967 
02968                 if (!q_n->ctr)
02969                         return False;
02970         }
02971 
02972         if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth))
02973                 return False;
02974 
02975         return True;
02976 }
02977 
02978 /*******************************************************************
02979  Reads or writes a structure.
02980  ********************************************************************/
02981 
02982 BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth)
02983 {
02984         if (r_n == NULL)
02985                 return False;
02986 
02987         prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info");
02988         depth++;
02989 
02990         if(!prs_align(ps))
02991                 return False;
02992 
02993         if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
02994                 return False;
02995 
02996         if(!prs_werror("status", ps, depth, &r_n->status))
02997                 return False;
02998 
02999         return True;
03000 }
03001 
03002 /*******************************************************************
03003  Reads or writes a structure.
03004  ********************************************************************/
03005 
03006 BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, 
03007                                prs_struct *ps, int depth)
03008 {
03009         prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info");
03010         depth++;
03011 
03012         if(!prs_align(ps))
03013                 return False;
03014 
03015         if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value))
03016                 return False;
03017 
03018         if(!prs_werror("status", ps, depth, &r_n->status))
03019                 return False;
03020 
03021         return True;
03022 }
03023 
03024 /*******************************************************************
03025  Reads or writes a structure.
03026  ********************************************************************/
03027 
03028 BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth)
03029 {
03030         if (q_n == NULL)
03031                 return False;
03032 
03033         prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod");
03034         depth++;
03035 
03036         if(!prs_align(ps))
03037                 return False;
03038 
03039         if(!prs_uint32("ptr_srv_name  ", ps, depth, &q_n->ptr_srv_name))
03040                 return False;
03041         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
03042                 return False;
03043 
03044         return True;
03045 }
03046 
03047 /*******************************************************************
03048  Reads or writes a TIME_OF_DAY_INFO structure.
03049  ********************************************************************/
03050 
03051 static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth)
03052 {
03053         if (tod == NULL)
03054                 return False;
03055 
03056         prs_debug(ps, depth, desc, "srv_io_time_of_day_info");
03057         depth++;
03058 
03059         if(!prs_align(ps))
03060                 return False;
03061         
03062         if(!prs_uint32("elapsedt   ", ps, depth, &tod->elapsedt))
03063                 return False;
03064         if(!prs_uint32("msecs      ", ps, depth, &tod->msecs))
03065                 return False;
03066         if(!prs_uint32("hours      ", ps, depth, &tod->hours))
03067                 return False;
03068         if(!prs_uint32("mins       ", ps, depth, &tod->mins))
03069                 return False;
03070         if(!prs_uint32("secs       ", ps, depth, &tod->secs))
03071                 return False;
03072         if(!prs_uint32("hunds      ", ps, depth, &tod->hunds))
03073                 return False;
03074         if(!prs_uint32("timezone   ", ps, depth, &tod->zone))
03075                 return False;
03076         if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals))
03077                 return False;
03078         if(!prs_uint32("day        ", ps, depth, &tod->day))
03079                 return False;
03080         if(!prs_uint32("month      ", ps, depth, &tod->month))
03081                 return False;
03082         if(!prs_uint32("year       ", ps, depth, &tod->year))
03083                 return False;
03084         if(!prs_uint32("weekday    ", ps, depth, &tod->weekday))
03085                 return False;
03086 
03087         return True;
03088 }
03089 
03090 /*******************************************************************
03091  Inits a TIME_OF_DAY_INFO structure.
03092  ********************************************************************/
03093 
03094 void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs,
03095                            uint32 hours, uint32 mins, uint32 secs, uint32 hunds,
03096                            uint32 zone, uint32 tintervals, uint32 day,
03097                            uint32 month, uint32 year, uint32 weekday)
03098 {
03099         DEBUG(5,("init_time_of_day_info\n"));
03100 
03101         tod->elapsedt   = elapsedt;
03102         tod->msecs      = msecs;
03103         tod->hours      = hours;
03104         tod->mins       = mins;
03105         tod->secs       = secs;
03106         tod->hunds      = hunds;
03107         tod->zone       = zone;
03108         tod->tintervals = tintervals;
03109         tod->day        = day;
03110         tod->month      = month;
03111         tod->year       = year;
03112         tod->weekday    = weekday;
03113 }
03114 
03115 
03116 /*******************************************************************
03117  Reads or writes a structure.
03118  ********************************************************************/
03119 
03120 BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth)
03121 {
03122         if (r_n == NULL)
03123                 return False;
03124 
03125         prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod");
03126         depth++;
03127 
03128         if(!prs_align(ps))
03129                 return False;
03130         
03131         if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod))
03132                 return False;
03133 
03134         if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
03135                 return False;
03136 
03137         if(!prs_werror("status", ps, depth, &r_n->status))
03138                 return False;
03139 
03140         return True;
03141 }
03142 
03143 /*******************************************************************
03144  initialises a structure.
03145  ********************************************************************/
03146 
03147 BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n,
03148                               const char *srv_name,
03149                               uint32 preferred_len,
03150                               ENUM_HND *enum_hnd
03151         ) 
03152 {
03153   
03154 
03155         DEBUG(5,("init_srv_q_net_srv_disk_enum\n"));
03156 
03157         init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name);
03158 
03159         q_n->disk_enum_ctr.level = 0;
03160         q_n->disk_enum_ctr.disk_info_ptr   = 0;
03161   
03162         q_n->preferred_len = preferred_len;
03163         memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd));
03164 
03165         return True;
03166 }
03167 
03168 /*******************************************************************
03169  Reads or writes a structure.
03170  ********************************************************************/
03171 
03172 BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth)
03173 {
03174         if (q_n == NULL)
03175                 return False;
03176 
03177         prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum");
03178         depth++;
03179 
03180         if(!prs_align(ps))
03181                 return False;
03182 
03183         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
03184                 return False;
03185 
03186         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
03187                 return False;
03188 
03189         if(!prs_align(ps))
03190                 return False;
03191 
03192         if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level))
03193                 return False;
03194 
03195         if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read))
03196                 return False;
03197 
03198         if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr))
03199                 return False;
03200 
03201         if(!prs_align(ps))
03202                 return False;
03203 
03204         if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len))
03205                 return False;
03206         if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth))
03207                 return False;
03208 
03209         return True;
03210 }
03211 
03212 /*******************************************************************
03213  Reads or writes a structure.
03214  ********************************************************************/
03215 
03216 BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth)
03217 {
03218 
03219         unsigned int i;
03220         uint32 entries_read, entries_read2, entries_read3;
03221 
03222         if (r_n == NULL)
03223                 return False;
03224 
03225         prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum");
03226         depth++;
03227 
03228         entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read;
03229 
03230         if(!prs_align(ps))
03231                 return False;
03232 
03233         if(!prs_uint32("entries_read", ps, depth, &entries_read))
03234                 return False;
03235         if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr))
03236                 return False;
03237 
03238         /*this may be max, unknown, actual?*/
03239 
03240         if(!prs_uint32("max_elements", ps, depth, &entries_read2))
03241                 return False;
03242         if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown))
03243                 return False;
03244         if(!prs_uint32("actual_elements", ps, depth, &entries_read3))
03245                 return False;
03246 
03247         r_n->disk_enum_ctr.entries_read = entries_read3;
03248 
03249         if(UNMARSHALLING(ps) && entries_read3) {
03250 
03251                 DISK_INFO *dinfo;
03252 
03253                 if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3)))
03254                         return False;
03255                 r_n->disk_enum_ctr.disk_info = dinfo;
03256         }
03257 
03258         for(i=0; i < entries_read3; i++) {
03259 
03260                 if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown))
03261                         return False;
03262    
03263                 if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth))
03264                         return False;
03265 
03266                 if(!prs_align(ps))
03267                         return False;
03268         }
03269 
03270         if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries))
03271                 return False;
03272 
03273         if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
03274                 return False;
03275 
03276         if(!prs_werror("status", ps, depth, &r_n->status))
03277                 return False;
03278 
03279         return True;
03280 }
03281 
03282 /*******************************************************************
03283  Reads or writes a structure.
03284  ********************************************************************/
03285 
03286 BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth)
03287 {
03288         if (q_n == NULL)
03289                 return False;
03290 
03291         prs_debug(ps, depth, desc, "srv_io_q_net_name_validate");
03292         depth++;
03293 
03294         if(!prs_align(ps))
03295                 return False;
03296 
03297         if(!prs_pointer("servername", ps, depth, (void**)&q_n->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
03298                 return False;
03299 
03300         if(!prs_align(ps))
03301                 return False;
03302 
03303         if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth))
03304                 return False;
03305 
03306         if(!prs_align(ps))
03307                 return False;
03308 
03309         if(!prs_uint32("type", ps, depth, &q_n->type))
03310                 return False;
03311 
03312         if(!prs_uint32("flags", ps, depth, &q_n->flags))
03313                 return False;
03314 
03315         return True;
03316 }
03317 
03318 /*******************************************************************
03319  Reads or writes a structure.
03320  ********************************************************************/
03321 
03322 BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth)
03323 {
03324         if (r_n == NULL)
03325                 return False;
03326 
03327         prs_debug(ps, depth, desc, "srv_io_r_net_name_validate");
03328         depth++;
03329 
03330         if(!prs_align(ps))
03331                 return False;
03332 
03333         if(!prs_werror("status", ps, depth, &r_n->status))
03334                 return False;
03335 
03336         return True;
03337 }
03338 
03339 /*******************************************************************
03340  Reads or writes a structure.
03341 ********************************************************************/
03342 
03343 BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth)
03344 {
03345         if (q_n == NULL)
03346                 return False;
03347 
03348         prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc");
03349         depth++;
03350 
03351         if(!prs_align(ps))
03352                 return False;
03353 
03354         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
03355                 return False;
03356 
03357         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
03358                 return False;
03359 
03360         if(!prs_align(ps))
03361                 return False;
03362 
03363         if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
03364                 return False;
03365 
03366         if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
03367                 return False;
03368 
03369         if(!prs_align(ps))
03370                 return False;
03371 
03372         if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
03373                 return False;
03374 
03375         if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1))
03376                 return False;
03377 
03378         if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2))
03379                 return False;
03380 
03381         if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3))
03382                 return False;
03383 
03384         return True;
03385 }
03386 
03387 /*******************************************************************
03388  Reads or writes a structure.
03389 ********************************************************************/
03390 
03391 BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth)
03392 {
03393         if (r_n == NULL)
03394                 return False;
03395 
03396         prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc");
03397         depth++;
03398 
03399         if(!prs_align(ps))
03400                 return False;
03401 
03402         if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response))
03403                 return False;
03404 
03405         if(!prs_uint32("size_response", ps, depth, &r_n->size_response))
03406                 return False;
03407 
03408         if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc))
03409                 return False;
03410 
03411         if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc))
03412                 return False;
03413 
03414         if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth))
03415                 return False;
03416 
03417         if(!prs_align(ps))
03418                 return False;
03419 
03420         if(!prs_werror("status", ps, depth, &r_n->status))
03421                 return False;
03422 
03423         return True;
03424 }
03425 
03426 /*******************************************************************
03427  Reads or writes a structure.
03428 ********************************************************************/
03429 
03430 BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth)
03431 {
03432         if (q_n == NULL)
03433                 return False;
03434 
03435         prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc");
03436         depth++;
03437 
03438         if(!prs_align(ps))
03439                 return False;
03440 
03441         if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name))
03442                 return False;
03443 
03444         if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth))
03445                 return False;
03446 
03447         if(!prs_align(ps))
03448                 return False;
03449 
03450         if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name))
03451                 return False;
03452 
03453         if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth))
03454                 return False;
03455 
03456         if(!prs_align(ps))
03457                 return False;
03458 
03459         if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth))
03460                 return False;
03461 
03462         if(!prs_align(ps))
03463                 return False;
03464 
03465         if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info))
03466                 return False;
03467 
03468         if(!prs_uint32("size_set", ps, depth, &q_n->size_set))
03469                 return False;
03470 
03471         if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc))
03472                 return False;
03473 
03474         if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc))
03475                 return False;
03476 
03477         if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth))
03478                 return False;
03479 
03480         return True;
03481 }
03482 
03483 /*******************************************************************
03484  Reads or writes a structure.
03485 ********************************************************************/
03486 
03487 BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth)
03488 {
03489         if (r_n == NULL)
03490                 return False;
03491 
03492         prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc");
03493         depth++;
03494 
03495         if(!prs_align(ps))
03496                 return False;
03497 
03498         if(!prs_werror("status", ps, depth, &r_n->status))
03499                 return False;
03500 
03501         return True;
03502 }
03503 
03504 /*******************************************************************
03505  Inits a structure
03506 ********************************************************************/
03507 
03508 void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server)
03509 {
03510         q_u->ptr_srv_name = 1;
03511         init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE);
03512 }
03513 
03514 
03515 /*******************************************************************
03516  Reads or writes a structure.
03517 ********************************************************************/
03518 
03519 BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_u, prs_struct *ps, int depth)
03520 {
03521         if (q_u == NULL)
03522                 return False;
03523 
03524         prs_debug(ps, depth, desc, "srv_io_q_net_file_close");
03525         depth++;
03526 
03527         if(!prs_align(ps))
03528                 return False;
03529 
03530         if(!prs_pointer("servername", ps, depth, (void**)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
03531                 return False;
03532         if(!prs_align(ps))
03533                 return False;
03534 
03535         if(!prs_uint32("file_id", ps, depth, &q_u->file_id))
03536                 return False;
03537                 
03538         return True;
03539 }
03540 
03541 /*******************************************************************
03542  ********************************************************************/
03543 
03544 BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *r_n, 
03545                                prs_struct *ps, int depth)
03546 {
03547         prs_debug(ps, depth, desc, "srv_io_r_net_file_close");
03548         depth++;
03549 
03550         if(!prs_align(ps))
03551                 return False;
03552 
03553         if(!prs_werror("status", ps, depth, &r_n->status))
03554                 return False;
03555 
03556         return True;
03557 }

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