passdb/pdb_compat.c

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    struct samu access routines
00004    Copyright (C) Jeremy Allison                 1996-2001
00005    Copyright (C) Luke Kenneth Casson Leighton   1996-1998
00006    Copyright (C) Gerald (Jerry) Carter          2000-2001
00007    Copyright (C) Andrew Bartlett                2001-2002
00008    Copyright (C) Stefan (metze) Metzmacher      2002
00009       
00010    This program is free software; you can redistribute it and/or modify
00011    it under the terms of the GNU General Public License as published by
00012    the Free Software Foundation; either version 2 of the License, or
00013    (at your option) any later version.
00014    
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019    
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023 */
00024 
00025 #include "includes.h"
00026 
00027 #undef DBGC_CLASS
00028 #define DBGC_CLASS DBGC_PASSDB
00029 
00030 uint32 pdb_get_user_rid (const struct samu *sampass)
00031 {
00032         uint32 u_rid;
00033 
00034         if (sampass)
00035                 if (sid_peek_check_rid(get_global_sam_sid(), pdb_get_user_sid(sampass),&u_rid))
00036                         return u_rid;
00037         
00038         return (0);
00039 }
00040 
00041 uint32 pdb_get_group_rid (struct samu *sampass)
00042 {
00043         uint32 g_rid;
00044 
00045         if (sampass)
00046                 if (sid_peek_check_rid(get_global_sam_sid(), pdb_get_group_sid(sampass),&g_rid))
00047                         return g_rid;
00048         return (0);
00049 }
00050 
00051 BOOL pdb_set_user_sid_from_rid (struct samu *sampass, uint32 rid, enum pdb_value_state flag)
00052 {
00053         DOM_SID u_sid;
00054         const DOM_SID *global_sam_sid;
00055         
00056         if (!sampass)
00057                 return False;
00058 
00059         if (!(global_sam_sid = get_global_sam_sid())) {
00060                 DEBUG(1, ("pdb_set_user_sid_from_rid: Could not read global sam sid!\n"));
00061                 return False;
00062         }
00063 
00064         sid_copy(&u_sid, global_sam_sid);
00065 
00066         if (!sid_append_rid(&u_sid, rid))
00067                 return False;
00068 
00069         if (!pdb_set_user_sid(sampass, &u_sid, flag))
00070                 return False;
00071 
00072         DEBUG(10, ("pdb_set_user_sid_from_rid:\n\tsetting user sid %s from rid %d\n", 
00073                     sid_string_static(&u_sid),rid));
00074 
00075         return True;
00076 }
00077 
00078 BOOL pdb_set_group_sid_from_rid (struct samu *sampass, uint32 grid, enum pdb_value_state flag)
00079 {
00080         DOM_SID g_sid;
00081         const DOM_SID *global_sam_sid;
00082 
00083         if (!sampass)
00084                 return False;
00085         
00086         if (!(global_sam_sid = get_global_sam_sid())) {
00087                 DEBUG(1, ("pdb_set_user_sid_from_rid: Could not read global sam sid!\n"));
00088                 return False;
00089         }
00090 
00091         sid_copy(&g_sid, global_sam_sid);
00092         
00093         if (!sid_append_rid(&g_sid, grid))
00094                 return False;
00095 
00096         if (!pdb_set_group_sid(sampass, &g_sid, flag))
00097                 return False;
00098 
00099         DEBUG(10, ("pdb_set_group_sid_from_rid:\n\tsetting group sid %s from rid %d\n", 
00100                     sid_string_static(&g_sid), grid));
00101 
00102         return True;
00103 }
00104 

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