return len;
}
-
-
-/**
- Copy a string from a ucs2 source to a unix char* destination.
- Flags can have:
- STR_TERMINATE means the string in src is null terminated.
- STR_NOALIGN means don't try to align.
- if STR_TERMINATE is set then src_len is ignored if it is -1.
- src_len is the length of the source area in bytes
- Return the number of bytes occupied by the string in src.
- The resulting string in "dest" is always null terminated.
-**/
-
-static size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags)
-{
- size_t size = 0;
- size_t ucs2_align_len = 0;
- bool ret;
-
- if (dest_len == (size_t)-1) {
- /* No longer allow dest_len of -1. */
- smb_panic("pull_ucs2 - invalid dest_len of -1");
- }
-
- if (!src_len) {
- if (dest && dest_len > 0) {
- dest[0] = '\0';
- }
- return 0;
- }
-
- if (ucs2_align(base_ptr, src, flags)) {
- src = (const void *)((const char *)src + 1);
- if (src_len != (size_t)-1)
- src_len--;
- ucs2_align_len = 1;
- }
-
- if (flags & STR_TERMINATE) {
- /* src_len -1 is the default for null terminated strings. */
- if (src_len != (size_t)-1) {
- size_t len = strnlen_w((const smb_ucs2_t *)src,
- src_len/2);
- if (len < src_len/2)
- len++;
- src_len = len*2;
- }
- }
-
- /* ucs2 is always a multiple of 2 bytes */
- if (src_len != (size_t)-1)
- src_len &= ~1;
-
- ret = convert_string(CH_UTF16LE, CH_UNIX, src, src_len, dest, dest_len, &size);
- if (ret == false) {
- size = 0;
- dest_len = 0;
- }
-
- if (src_len == (size_t)-1)
- src_len = size*2;
-
- if (dest_len && size) {
- /* Did we already process the terminating zero ? */
- if (dest[MIN(size-1, dest_len-1)] != 0) {
- dest[MIN(size, dest_len-1)] = 0;
- }
- } else {
- dest[0] = 0;
- }
-
- return src_len + ucs2_align_len;
-}
-
/**
Copy a string from a ucs2 source to a unix char* destination.
Talloc version with a base pointer.
static int gse_context_destructor(void *ptr)
{
struct gse_context *gse_ctx;
- OM_uint32 gss_min, gss_maj;
+ OM_uint32 gss_min;
gse_ctx = talloc_get_type_abort(ptr, struct gse_context);
if (gse_ctx->k5ctx) {
gse_ctx->k5ctx = NULL;
}
if (gse_ctx->gssapi_context != GSS_C_NO_CONTEXT) {
- gss_maj = gss_delete_sec_context(&gss_min,
+ (void)gss_delete_sec_context(&gss_min,
&gse_ctx->gssapi_context,
GSS_C_NO_BUFFER);
}
if (gse_ctx->server_name) {
- gss_maj = gss_release_name(&gss_min,
+ (void)gss_release_name(&gss_min,
&gse_ctx->server_name);
}
if (gse_ctx->client_name) {
- gss_maj = gss_release_name(&gss_min,
+ (void)gss_release_name(&gss_min,
&gse_ctx->client_name);
}
if (gse_ctx->creds) {
- gss_maj = gss_release_cred(&gss_min,
+ (void)gss_release_cred(&gss_min,
&gse_ctx->creds);
}
if (gse_ctx->delegated_cred_handle) {
- gss_maj = gss_release_cred(&gss_min,
+ (void)gss_release_cred(&gss_min,
&gse_ctx->delegated_cred_handle);
}
subreq, struct tevent_req);
struct cli_symlink_state *state = tevent_req_data(
req, struct cli_symlink_state);
- NTSTATUS status;
-
- status = cli_nt_delete_on_close_recv(subreq);
- TALLOC_FREE(subreq);
/*
* Ignore status, we can't do much anyway in case of failure
*/
+ (void)cli_nt_delete_on_close_recv(subreq);
+ TALLOC_FREE(subreq);
+
subreq = cli_close_send(state, state->ev, state->cli, state->fnum);
if (tevent_req_nomem(subreq, req)) {
return;
int job_id; /* job-id attribute */
int job_k_octets; /* job-k-octets attribute */
time_t job_time; /* time-at-creation attribute */
- time_t printer_current_time = 0; /* printer's current time */
time_t printer_up_time = 0; /* printer's uptime */
ipp_jstate_t job_status; /* job-status attribute */
int job_priority; /* job-priority attribute */
IPP_TAG_TEXT)) != NULL)
fstrcpy(status->message, attr->values[0].string.text);
- if ((attr = ippFindAttribute(response, "printer-current-time",
- IPP_TAG_DATE)) != NULL)
- printer_current_time = ippDateToTime(attr->values[0].date);
-
if ((attr = ippFindAttribute(response, "printer-up-time",
IPP_TAG_INTEGER)) != NULL)
printer_up_time = attr->values[0].integer;
{
struct smb_request req;
uint16_t num_replies;
- size_t out_len;
char *outbuf;
bool ok;
memcpy(smb_buf(req.outbuf), req.buf, req.buflen);
}
- out_len = smb_len(req.outbuf) + 4;
-
ok = srv_send_smb(req.sconn,
(char *)outbuf,
true, seqnum+1,
size_t smb_maxcnt)
{
int outsize;
- char *data;
outsize = srv_set_message(outbuf,12,smb_maxcnt,False);
- data = smb_buf(outbuf);
memset(outbuf+smb_vwv0,'\0',24); /* valgrind init. */
{
const uint8_t *inbody;
int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
uint16_t in_flags;
uint64_t in_file_id_persistent;
return smbd_smb2_request_error(req, status);
}
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
return smbd_smb2_request_done(req, outbody, NULL);
}
{
struct smbd_smb2_request *smb2req = tevent_req_callback_data(tsubreq,
struct smbd_smb2_request);
- int i = smb2req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint8_t out_oplock_level = 0;
out_context_buffer_offset = SMB2_HDR_BODY + 0x58;
}
- outhdr = (uint8_t *)smb2req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(smb2req->out.vector, NULL, 0x58);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(smb2req, NT_STATUS_NO_MEMORY);
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
- int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint16_t out_output_buffer_offset;
out_output_buffer_offset = SMB2_HDR_BODY + 0x08;
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x08);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
- int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint16_t out_output_buffer_offset;
out_output_buffer_offset = SMB2_HDR_BODY + 0x08;
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x08);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
struct smbd_smb2_request);
const uint8_t *inbody;
int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint32_t in_ctl_code;
in_file_id_persistent = BVAL(inbody, 0x08);
in_file_id_volatile = BVAL(inbody, 0x10);
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x30);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint16_t out_output_buffer_offset;
out_output_buffer_offset = SMB2_HDR_BODY + 0x08;
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x08);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
- int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint8_t out_data_offset;
out_data_offset = SMB2_HDR_BODY + 0x10;
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x10);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
for (idx=1; idx < count; idx += 3) {
const uint8_t *inhdr = NULL;
- uint32_t in_flags;
uint8_t *outhdr = NULL;
uint8_t *outbody = NULL;
uint32_t next_command_ofs = 0;
}
inhdr = (const uint8_t *)req->in.vector[idx].iov_base;
- in_flags = IVAL(inhdr, SMB2_HDR_FLAGS);
outhdr = talloc_zero_array(vector, uint8_t,
OUTVEC_ALLOC_SIZE);
{
struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
struct smbd_smb2_request);
- int i = req->current_idx;
- uint8_t *outhdr;
DATA_BLOB outbody;
DATA_BLOB outdyn;
uint32_t out_count = 0;
return;
}
- outhdr = (uint8_t *)req->out.vector[i].iov_base;
-
outbody = data_blob_talloc(req->out.vector, NULL, 0x10);
if (outbody.data == NULL) {
error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
uint32_t len;
struct timespec mdate_ts, adate_ts, cdate_ts, create_date_ts;
time_t mdate = (time_t)0, adate = (time_t)0, create_date = (time_t)0;
- time_t c_date = (time_t)0;
char *nameptr;
char *last_entry_ptr;
bool was_8_3;
create_date = convert_timespec_to_time_t(create_date_ts);
mdate = convert_timespec_to_time_t(mdate_ts);
adate = convert_timespec_to_time_t(adate_ts);
- c_date = convert_timespec_to_time_t(cdate_ts);
/* align the record */
SMB_ASSERT(align >= 1);
subreq, struct tevent_req);
struct wb_group_members_state *state = tevent_req_data(
req, struct wb_group_members_state);
- int i, num_groups, new_users, new_groups;
+ int i, num_groups, new_groups;
int num_members = 0;
struct wbint_Principal *members = NULL;
NTSTATUS status;
return;
}
- new_users = new_groups = 0;
+ new_groups = 0;
for (i=0; i<num_members; i++) {
switch (members[i].type) {
case SID_NAME_DOM_GRP:
struct winbind_cache *cache = get_cache(domain);
struct cache_entry *centry = NULL;
NTSTATUS status;
- time_t t;
uint32 rid;
fstring tmp;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- t = centry_time(centry);
-
/* In the salted case this isn't actually the nt_hash itself,
but the MD5 of the salt + nt_hash. Let the caller
sort this out. It can tell as we only return the cached_salt
do {
struct lsa_DomainList dom_list;
- uint32_t start_idx;
uint32_t i;
/*
}
}
- start_idx = count;
count += dom_list.count;
array = talloc_realloc(mem_ctx,