parse_dfs.c
来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 545 行 · 第 1/2 页
C
545 行
/* * Unix SMB/CIFS implementation. * MSDfs RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Shirish Kalele 2000. * Copyright (C) Jeremy Allison 2001. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include "includes.h"#undef DBGC_CLASS#define DBGC_CLASS DBGC_RPC_PARSE/******************************************************************* Make a DFS_Q_DFS_QUERY structure*******************************************************************/void init_dfs_q_dfs_exist(DFS_Q_DFS_EXIST *q_d){ q_d->dummy = 0;}/************************************************************* Read/write a DFS_Q_DFS_EXIST structure - dummy... ************************************************************/BOOL dfs_io_q_dfs_exist(const char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth){ if(q_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_q_dfs_exist"); return True;} /************************************************************* Read/write a DFS_R_DFS_EXIST structure ************************************************************/BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth){ if(q_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_r_dfs_exist"); depth++; if(!prs_align(ps)) return False; if(!prs_uint32("exist flag", ps, 0, &q_d->status)) return False; return True;} /******************************************************************* Make a DFS_Q_DFS_REMOVE structure*******************************************************************/BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, const char *servername, const char *sharename){ DEBUG(5,("init_dfs_q_dfs_remove\n")); init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); q_d->ptr_ServerName = q_d->ptr_ShareName = 1; return True;}/******************************************************************* Read/write a DFS_Q_DFS_REMOVE structure*******************************************************************/BOOL dfs_io_q_dfs_remove(const char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth){ if(q_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_q_dfs_remove"); depth++; if(!prs_align(ps)) return False; if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_ServerName", ps, depth, &q_d->ptr_ServerName)) return False; if(q_d->ptr_ServerName) if (!smb_io_unistr2("ServerName",&q_d->ServerName, q_d->ptr_ServerName, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) return False; if(q_d->ptr_ShareName) if (!smb_io_unistr2("ShareName",&q_d->ShareName, q_d->ptr_ShareName, ps, depth)) return False; if(!prs_align(ps)) return False; return True;}/******************************************************************* Read/write a DFS_R_DFS_REMOVE structure*******************************************************************/BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth){ if(r_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); depth++; if(!prs_werror("status", ps, depth, &r_d->status)) return False; return True;}/******************************************************************* Make a DFS_Q_DFS_ADD structure*******************************************************************/BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, const char *servername, const char *sharename, const char *comment, uint32 flags){ DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); if(comment != NULL) { init_unistr2(&q_d->Comment, comment,UNI_STR_TERMINATE); q_d->ptr_Comment = 1; } else { q_d->ptr_Comment = 0; } q_d->Flags = flags; return True;}/************************************************************ Read/write a DFS_Q_DFS_ADD structure ************************************************************/BOOL dfs_io_q_dfs_add(const char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth){ if(q_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_q_dfs_add"); depth++; if(!prs_align(ps)) return False; if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) return False; if(!prs_align(ps)) return False; if(!smb_io_unistr2("ServerName",&q_d->ServerName, 1, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) return False; if(!smb_io_unistr2("ShareName",&q_d->ShareName, 1, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_Comment", ps, depth, &q_d->ptr_Comment)) return False; if(!smb_io_unistr2("",&q_d->Comment, q_d->ptr_Comment , ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("Flags", ps, depth, &q_d->Flags)) return True; return True;}/************************************************************ Read/write a DFS_R_DFS_ADD structure ************************************************************/BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth){ if(r_d == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); depth++; if(!prs_werror("status", ps, depth, &r_d->status)) return False; return True;}BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, const char *servername, const char *sharename, uint32 info_level){ DEBUG(5,("init_dfs_q2_get_info\n")); init_unistr2(&q_d->uni_path, entrypath, UNI_STR_TERMINATE); init_unistr2(&q_d->uni_server, servername, UNI_STR_TERMINATE); init_unistr2(&q_d->uni_share, sharename, UNI_STR_TERMINATE); q_d->level = info_level; q_d->ptr_server = q_d->ptr_share = 1; return True;}/************************************************************ Read/write a DFS_Q_GET_INFO structure ************************************************************/BOOL dfs_io_q_dfs_get_info(const char *desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth){ if(q_i == NULL) return False; prs_debug(ps, depth, desc, "dfs_io_q_dfs_get_info"); depth++; if(!smb_io_unistr2("",&q_i->uni_path, 1, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_server", ps, depth, &q_i->ptr_server)) return False; if(q_i->ptr_server) if (!smb_io_unistr2("",&q_i->uni_server, q_i->ptr_server, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("ptr_share", ps, depth, &q_i->ptr_share))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?