61 uint32_t new_id;
62 uint16_t setup;
63 uint16_t mode;
64 int rc;
65 static uint32_t tmp_id = 10000;
66
67 bzero(op, sizeof (sr->arg.open));
68 rc = smbsr_decode_vwv(sr, "ww", &setup, &mode);
69 if (rc == 0)
70 rc = smbsr_decode_data(sr, "%S", sr, &identifier);
71
72 if (rc == 0) {
73 path = smb_srm_zalloc(sr, MAXPATHLEN);
74 op->fqi.fq_path.pn_path = path;
75 new_id = atomic_inc_32_nv(&tmp_id);
76 (void) snprintf(path, MAXPATHLEN, "%s%05u", identifier, new_id);
77 }
78
79 op->create_disposition = FILE_OVERWRITE_IF;
80 op->create_options = FILE_NON_DIRECTORY_FILE;
81 DTRACE_SMB_2(op__OpenPrintFile__start, smb_request_t *, sr,
82 struct open_param *, op);
83
84 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
85 }
86
87 void
88 smb_post_open_print_file(smb_request_t *sr)
89 {
90 DTRACE_SMB_1(op__OpenPrintFile__done, smb_request_t *, sr);
91 }
92
93 /*
94 * Creates a new spool file which will be later copied and
95 * deleted by cupsd. After the file is created, information
96 * related to the file will be placed in a spooldoc list
97 * to be later used by cupsd
98 *
99 * Return values
100 * rc 0 SDRC_SUCCESS
101 * rc non-zero SDRC_ERROR
102 */
|
61 uint32_t new_id;
62 uint16_t setup;
63 uint16_t mode;
64 int rc;
65 static uint32_t tmp_id = 10000;
66
67 bzero(op, sizeof (sr->arg.open));
68 rc = smbsr_decode_vwv(sr, "ww", &setup, &mode);
69 if (rc == 0)
70 rc = smbsr_decode_data(sr, "%S", sr, &identifier);
71
72 if (rc == 0) {
73 path = smb_srm_zalloc(sr, MAXPATHLEN);
74 op->fqi.fq_path.pn_path = path;
75 new_id = atomic_inc_32_nv(&tmp_id);
76 (void) snprintf(path, MAXPATHLEN, "%s%05u", identifier, new_id);
77 }
78
79 op->create_disposition = FILE_OVERWRITE_IF;
80 op->create_options = FILE_NON_DIRECTORY_FILE;
81 DTRACE_SMB_1(op__OpenPrintFile__start, smb_request_t *, sr); /* arg.open */
82
83 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
84 }
85
86 void
87 smb_post_open_print_file(smb_request_t *sr)
88 {
89 DTRACE_SMB_1(op__OpenPrintFile__done, smb_request_t *, sr);
90 }
91
92 /*
93 * Creates a new spool file which will be later copied and
94 * deleted by cupsd. After the file is created, information
95 * related to the file will be placed in a spooldoc list
96 * to be later used by cupsd
97 *
98 * Return values
99 * rc 0 SDRC_SUCCESS
100 * rc non-zero SDRC_ERROR
101 */
|