smbd/fake_file.c

ソースコードを見る。

関数

static struct _FAKE_FILE_HANDLEinit_fake_file_handle (enum FAKE_FILE_TYPE type)
enum FAKE_FILE_TYPE is_fake_file (const char *fname)
NTSTATUS open_fake_file (connection_struct *conn, enum FAKE_FILE_TYPE fake_file_type, const char *fname, uint32 access_mask, files_struct **result)
void destroy_fake_file_handle (FAKE_FILE_HANDLE **fh)
NTSTATUS close_fake_file (files_struct *fsp)

変数

current_user current_user
static FAKE_FILE fake_files []


関数

static struct _FAKE_FILE_HANDLE* init_fake_file_handle ( enum FAKE_FILE_TYPE  type  )  [static]

fake_file.c36 行で定義されています。

参照先 fake_files_FAKE_FILE::free_pd_FAKE_FILE_HANDLE::free_pd_FAKE_FILE::init_pd_FAKE_FILE_HANDLE::mem_ctxname_FAKE_FILE::name_FAKE_FILE_HANDLE::pdtalloc_init()_FAKE_FILE_HANDLE::type.

参照元 open_fake_file().

00037 {
00038         TALLOC_CTX *mem_ctx = NULL;
00039         FAKE_FILE_HANDLE *fh = NULL;
00040         int i;
00041 
00042         for (i=0;fake_files[i].name!=NULL;i++) {
00043                 if (fake_files[i].type==type) {
00044                         DEBUG(5,("init_fake_file_handle: for [%s]\n",fake_files[i].name));
00045 
00046                         if ((mem_ctx=talloc_init("fake_file_handle"))==NULL) {
00047                                 DEBUG(0,("talloc_init(fake_file_handle) failed.\n"));
00048                                 return NULL;    
00049                         }
00050 
00051                         if ((fh =TALLOC_ZERO_P(mem_ctx, FAKE_FILE_HANDLE))==NULL) {
00052                                 DEBUG(0,("TALLOC_ZERO() failed.\n"));
00053                                 talloc_destroy(mem_ctx);
00054                                 return NULL;
00055                         }
00056 
00057                         fh->type = type;
00058                         fh->mem_ctx = mem_ctx;
00059 
00060                         if (fake_files[i].init_pd) {
00061                                 fh->pd = fake_files[i].init_pd(fh->mem_ctx);
00062                         }
00063 
00064                         fh->free_pd = fake_files[i].free_pd;
00065 
00066                         return fh;
00067                 }
00068         }
00069 
00070         return NULL;    
00071 }

enum FAKE_FILE_TYPE is_fake_file ( const char *  fname  ) 

fake_file.c77 行で定義されています。

参照先 FAKE_FILE_TYPE_NONEfake_filesname_FAKE_FILE::name_FAKE_FILE::type.

参照元 reply_ntcreate_and_X().

00078 {
00079 #ifdef HAVE_SYS_QUOTAS
00080         int i;
00081 #endif
00082 
00083         if (!fname) {
00084                 return FAKE_FILE_TYPE_NONE;
00085         }
00086 
00087 #ifdef HAVE_SYS_QUOTAS
00088         for (i=0;fake_files[i].name!=NULL;i++) {
00089                 if (strncmp(fname,fake_files[i].name,strlen(fake_files[i].name))==0) {
00090                         DEBUG(5,("is_fake_file: [%s] is a fake file\n",fname));
00091                         return fake_files[i].type;
00092                 }
00093         }
00094 #endif
00095 
00096         return FAKE_FILE_TYPE_NONE;
00097 }

NTSTATUS open_fake_file ( connection_struct conn,
enum FAKE_FILE_TYPE  fake_file_type,
const char *  fname,
uint32  access_mask,
files_struct **  result 
)

fake_file.c104 行で定義されています。

参照先 files_struct::access_maskfiles_struct::can_lockfiles_struct::conncurrent_userfiles_struct::fake_file_handlefd_handle::fdfiles_struct::fhfile_free()file_new()files_struct::fnumfiles_struct::fsp_nameinit_fake_file_handle()connection_struct::num_files_openfd_handle::posresultstatusstring_set()_unix_token::uidconnection_struct::usercurrent_user::utcurrent_user::vuidfiles_struct::vuid.

参照元 reply_ntcreate_and_X_quota().

00109 {
00110         files_struct *fsp = NULL;
00111         NTSTATUS status;
00112 
00113         /* access check */
00114         if (current_user.ut.uid != 0) {
00115                 DEBUG(1,("open_fake_file_shared: access_denied to service[%s] file[%s] user[%s]\n",
00116                         lp_servicename(SNUM(conn)),fname,conn->user));
00117                 return NT_STATUS_ACCESS_DENIED;
00118 
00119         }
00120 
00121         status = file_new(conn, &fsp);
00122         if(!NT_STATUS_IS_OK(status)) {
00123                 return status;
00124         }
00125 
00126         DEBUG(5,("open_fake_file_shared: fname = %s, FID = %d, access_mask = 0x%x\n",
00127                 fname, fsp->fnum, (unsigned int)access_mask));
00128 
00129         fsp->conn = conn;
00130         fsp->fh->fd = -1;
00131         fsp->vuid = current_user.vuid;
00132         fsp->fh->pos = -1;
00133         fsp->can_lock = False; /* Should this be true ? - No, JRA */
00134         fsp->access_mask = access_mask;
00135         string_set(&fsp->fsp_name,fname);
00136         
00137         fsp->fake_file_handle = init_fake_file_handle(fake_file_type);
00138         
00139         if (fsp->fake_file_handle==NULL) {
00140                 file_free(fsp);
00141                 return NT_STATUS_NO_MEMORY;
00142         }
00143 
00144         conn->num_files_open++;
00145         *result = fsp;
00146         return NT_STATUS_OK;
00147 }

void destroy_fake_file_handle ( FAKE_FILE_HANDLE **  fh  ) 

fake_file.c149 行で定義されています。

参照元 file_free().

00150 {
00151         if (!fh||!(*fh)) {
00152                 return;
00153         }
00154 
00155         if ((*fh)->free_pd) {
00156                 (*fh)->free_pd(&(*fh)->pd);             
00157         }
00158 
00159         talloc_destroy((*fh)->mem_ctx);
00160         (*fh) = NULL;
00161 }

NTSTATUS close_fake_file ( files_struct fsp  ) 

fake_file.c163 行で定義されています。

参照先 file_free().

参照元 close_file().

00164 {
00165         file_free(fsp);
00166         return NT_STATUS_OK;
00167 }


変数

struct current_user current_user

smbrun.c24 行で定義されています。

FAKE_FILE fake_files[] [static]

初期値:

 {
#ifdef WITH_QUOTAS
        {FAKE_FILE_NAME_QUOTA_UNIX,     FAKE_FILE_TYPE_QUOTA,   init_quota_handle,      destroy_quota_handle},
#endif 
        {NULL,                          FAKE_FILE_TYPE_NONE,    NULL,                   NULL }
}

fake_file.c25 行で定義されています。

参照元 init_fake_file_handle()is_fake_file().


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