関数 | |
NTSTATUS | print_fsp_open (connection_struct *conn, const char *fname, files_struct **result) |
void | print_fsp_end (files_struct *fsp, enum file_close_type close_type) |
変数 | |
current_user | current_user |
NTSTATUS print_fsp_open | ( | connection_struct * | conn, | |
const char * | fname, | |||
files_struct ** | result | |||
) |
printfsp.c の 31 行で定義されています。
参照先 files_struct::access_mask・files_struct::can_lock・files_struct::can_read・files_struct::can_write・current_user::conn・current_user・files_struct::dev・errno・fd_handle::fd・files_struct::fh・file_free()・file_new()・files_struct::fsp_name・GetTimeOfDay()・files_struct::inode・files_struct::is_directory・map_nt_error_from_unix()・files_struct::mode・files_struct::modified・name・connection_struct::num_files_open・files_struct::open_time・files_struct::oplock_type・pjob_delete()・pjobid_to_rap()・fd_handle::pos・files_struct::print_file・print_job_fd()・print_job_fname()・print_job_start()・files_struct::rap_print_jobid・result・files_struct::sent_oplock_break・status・string_set()・current_user::vuid・files_struct::vuid・files_struct::wbmpx_ptr・files_struct::wcp.
参照元 open_file_ntcreate()・reply_printopen().
00033 { 00034 int jobid; 00035 SMB_STRUCT_STAT sbuf; 00036 files_struct *fsp; 00037 fstring name; 00038 NTSTATUS status; 00039 00040 status = file_new(conn, &fsp); 00041 if(!NT_STATUS_IS_OK(status)) { 00042 return status; 00043 } 00044 00045 fstrcpy( name, "Remote Downlevel Document"); 00046 if (fname) { 00047 const char *p = strrchr(fname, '/'); 00048 fstrcat(name, " "); 00049 if (!p) { 00050 p = fname; 00051 } 00052 fstrcat(name, p); 00053 } 00054 00055 jobid = print_job_start(¤t_user, SNUM(conn), name, NULL); 00056 if (jobid == -1) { 00057 status = map_nt_error_from_unix(errno); 00058 file_free(fsp); 00059 return status; 00060 } 00061 00062 /* Convert to RAP id. */ 00063 fsp->rap_print_jobid = pjobid_to_rap(lp_const_servicename(SNUM(conn)), jobid); 00064 if (fsp->rap_print_jobid == 0) { 00065 /* We need to delete the entry in the tdb. */ 00066 pjob_delete(lp_const_servicename(SNUM(conn)), jobid); 00067 file_free(fsp); 00068 return NT_STATUS_ACCESS_DENIED; /* No errno around here */ 00069 } 00070 00071 /* setup a full fsp */ 00072 fsp->fh->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid); 00073 GetTimeOfDay(&fsp->open_time); 00074 fsp->vuid = current_user.vuid; 00075 fsp->fh->pos = -1; 00076 fsp->can_lock = True; 00077 fsp->can_read = False; 00078 fsp->access_mask = FILE_GENERIC_WRITE; 00079 fsp->can_write = True; 00080 fsp->print_file = True; 00081 fsp->modified = False; 00082 fsp->oplock_type = NO_OPLOCK; 00083 fsp->sent_oplock_break = NO_BREAK_SENT; 00084 fsp->is_directory = False; 00085 string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); 00086 fsp->wbmpx_ptr = NULL; 00087 fsp->wcp = NULL; 00088 SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf); 00089 fsp->mode = sbuf.st_mode; 00090 fsp->inode = sbuf.st_ino; 00091 fsp->dev = sbuf.st_dev; 00092 00093 conn->num_files_open++; 00094 00095 *result = fsp; 00096 return NT_STATUS_OK; 00097 }
void print_fsp_end | ( | files_struct * | fsp, | |
enum file_close_type | close_type | |||
) |
printfsp.c の 103 行で定義されています。
参照先 files_struct::conn・fd_handle::fd・files_struct::fh・files_struct::fsp_name・print_job_end()・fd_handle::private_options・files_struct::rap_print_jobid・rap_to_pjobid()・string_free()・sys_ftruncate().
参照元 close_normal_file().
00104 { 00105 uint32 jobid; 00106 fstring sharename; 00107 00108 if (fsp->fh->private_options & FILE_DELETE_ON_CLOSE) { 00109 /* 00110 * Truncate the job. print_job_end will take 00111 * care of deleting it for us. JRA. 00112 */ 00113 sys_ftruncate(fsp->fh->fd, 0); 00114 } 00115 00116 if (fsp->fsp_name) { 00117 string_free(&fsp->fsp_name); 00118 } 00119 00120 if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { 00121 DEBUG(3,("print_fsp_end: Unable to convert RAP jobid %u to print jobid.\n", 00122 (unsigned int)fsp->rap_print_jobid )); 00123 return; 00124 } 00125 00126 print_job_end(SNUM(fsp->conn),jobid, close_type); 00127 }
struct current_user current_user |