DATA_BLOB send_blob;
- TALLOC_CTX *tmp_ctx = talloc_new(NULL);
- if (!tmp_ctx) {
+ TALLOC_CTX *frame = talloc_stackframe();
+ if (frame == NULL) {
return ENOMEM;
}
for (a = ai; a; a = a->ai_next) {
struct socket_address *remote_addr;
- smb_krb5 = talloc(tmp_ctx, struct smb_krb5_socket);
+ smb_krb5 = talloc(frame, struct smb_krb5_socket);
if (!smb_krb5) {
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return ENOMEM;
}
smb_krb5->hi = hi;
break;
#endif
default:
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return EINVAL;
}
status = socket_create(name, SOCKET_TYPE_STREAM, &smb_krb5->sock, 0);
break;
case KRB5_KRBHST_HTTP:
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return EINVAL;
}
if (!NT_STATUS_IS_OK(status)) {
packet_send(smb_krb5->packet, smb_krb5->request);
break;
case KRB5_KRBHST_HTTP:
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return EINVAL;
}
while ((NT_STATUS_IS_OK(smb_krb5->status)) && !smb_krb5->reply.length) {
if (tevent_loop_once(ev) != 0) {
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return EINVAL;
}
func,
data);
if (ret != 0) {
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return ret;
}
}
ret = krb5_data_copy(recv_buf, smb_krb5->reply.data, smb_krb5->reply.length);
if (ret) {
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return ret;
}
talloc_free(smb_krb5);
break;
}
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
if (a) {
return 0;
}
struct addrinfo *ai;
struct tevent_context *ev;
- TALLOC_CTX *tmp_ctx = talloc_new(NULL);
- if (!tmp_ctx) {
+ TALLOC_CTX *frame = talloc_stackframe();
+ if (frame == NULL) {
return ENOMEM;
}
- if (!data) {
+ if (data == NULL) {
/* If no event context was available, then create one for this loop */
- ev = samba_tevent_context_init(tmp_ctx);
- if (!ev) {
- talloc_free(tmp_ctx);
+ ev = samba_tevent_context_init(frame);
+ if (ev == NULL) {
+ TALLOC_FREE(frame);
return ENOMEM;
}
} else {
ret = krb5_krbhst_get_addrinfo(context, hi, &ai);
if (ret) {
- talloc_free(tmp_ctx);
+ TALLOC_FREE(frame);
return ret;
}
- return smb_krb5_send_and_recv_func_int(context, ev, hi, ai, smb_krb5_send_and_recv_func, data, timeout, send_buf, recv_buf);
+
+ ret = smb_krb5_send_and_recv_func_int(context, ev, hi, ai, smb_krb5_send_and_recv_func, data, timeout, send_buf, recv_buf);
+ TALLOC_FREE(frame);
+ return ret;
}
krb5_error_code smb_krb5_send_and_recv_func_forced(krb5_context context,
const krb5_data *send_buf,
krb5_data *recv_buf)
{
+ krb5_error_code k5ret;
struct addrinfo *ai = data;
struct tevent_context *ev;
- TALLOC_CTX *tmp_ctx = talloc_new(NULL);
- if (!tmp_ctx) {
+ TALLOC_CTX *frame = talloc_stackframe();
+ if (frame == NULL) {
return ENOMEM;
}
- /* If no event context was available, then create one for this loop */
- ev = samba_tevent_context_init(tmp_ctx);
- if (!ev) {
- talloc_free(tmp_ctx);
+ /* no event context is passed in, create one for this loop */
+ ev = samba_tevent_context_init(frame);
+ if (ev == NULL) {
+ TALLOC_FREE(frame);
return ENOMEM;
}
/* No need to pass in send_and_recv functions, we won't nest on this private event loop */
- return smb_krb5_send_and_recv_func_int(context, ev, hi, ai, NULL, NULL,
- timeout, send_buf, recv_buf);
+ k5ret = smb_krb5_send_and_recv_func_int(context, ev, hi, ai, NULL, NULL,
+ timeout, send_buf, recv_buf);
+ TALLOC_FREE(frame);
+ return k5ret;
}
#endif