mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
s4:auth/kerberos: convert to tevent_* api
metze
This commit is contained in:
parent
c652b42612
commit
c72cbce6ee
@ -2,7 +2,7 @@
|
||||
# Start SUBSYSTEM KERBEROS
|
||||
[SUBSYSTEM::KERBEROS]
|
||||
PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 NDR_KRB5PAC samba_socket LIBCLI_RESOLVE
|
||||
PRIVATE_DEPENDENCIES = ASN1_UTIL auth_sam_reply LIBPACKET LIBNDR
|
||||
PRIVATE_DEPENDENCIES = ASN1_UTIL auth_sam_reply LIBTEVENT LIBPACKET LIBNDR
|
||||
# End SUBSYSTEM KERBEROS
|
||||
#################################
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "system/kerberos.h"
|
||||
#include <tevent.h>
|
||||
#include "auth/kerberos/kerberos.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "lib/stream/packet.h"
|
||||
#include "system/network.h"
|
||||
#include "lib/events/events.h"
|
||||
#include "param/param.h"
|
||||
#include "libcli/resolve/resolve.h"
|
||||
|
||||
@ -159,9 +159,9 @@ static void smb_krb5_socket_send(struct smb_krb5_socket *smb_krb5)
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) return;
|
||||
|
||||
EVENT_FD_READABLE(smb_krb5->fde);
|
||||
TEVENT_FD_READABLE(smb_krb5->fde);
|
||||
|
||||
EVENT_FD_NOT_WRITEABLE(smb_krb5->fde);
|
||||
TEVENT_FD_NOT_WRITEABLE(smb_krb5->fde);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,22 +175,22 @@ static void smb_krb5_socket_handler(struct tevent_context *ev, struct tevent_fd
|
||||
struct smb_krb5_socket *smb_krb5 = talloc_get_type(private, struct smb_krb5_socket);
|
||||
switch (smb_krb5->hi->proto) {
|
||||
case KRB5_KRBHST_UDP:
|
||||
if (flags & EVENT_FD_READ) {
|
||||
if (flags & TEVENT_FD_READ) {
|
||||
smb_krb5_socket_recv(smb_krb5);
|
||||
return;
|
||||
}
|
||||
if (flags & EVENT_FD_WRITE) {
|
||||
if (flags & TEVENT_FD_WRITE) {
|
||||
smb_krb5_socket_send(smb_krb5);
|
||||
return;
|
||||
}
|
||||
/* not reached */
|
||||
return;
|
||||
case KRB5_KRBHST_TCP:
|
||||
if (flags & EVENT_FD_READ) {
|
||||
if (flags & TEVENT_FD_READ) {
|
||||
packet_recv(smb_krb5->packet);
|
||||
return;
|
||||
}
|
||||
if (flags & EVENT_FD_WRITE) {
|
||||
if (flags & TEVENT_FD_WRITE) {
|
||||
packet_queue_run(smb_krb5->packet);
|
||||
return;
|
||||
}
|
||||
@ -292,17 +292,16 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
|
||||
tevent_fd_set_close_fn(smb_krb5->fde, socket_tevent_fd_close_fn);
|
||||
socket_set_flags(smb_krb5->sock, SOCKET_FLAG_NOCLOSE);
|
||||
|
||||
event_add_timed(ev, smb_krb5,
|
||||
tevent_add_timer(ev, smb_krb5,
|
||||
timeval_current_ofs(timeout, 0),
|
||||
smb_krb5_request_timeout, smb_krb5);
|
||||
|
||||
|
||||
smb_krb5->status = NT_STATUS_OK;
|
||||
smb_krb5->reply = data_blob(NULL, 0);
|
||||
|
||||
switch (hi->proto) {
|
||||
case KRB5_KRBHST_UDP:
|
||||
EVENT_FD_WRITEABLE(smb_krb5->fde);
|
||||
TEVENT_FD_WRITEABLE(smb_krb5->fde);
|
||||
smb_krb5->request = send_blob;
|
||||
break;
|
||||
case KRB5_KRBHST_TCP:
|
||||
@ -330,7 +329,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
|
||||
return EINVAL;
|
||||
}
|
||||
while ((NT_STATUS_IS_OK(smb_krb5->status)) && !smb_krb5->reply.length) {
|
||||
if (event_loop_once(ev) != 0) {
|
||||
if (tevent_loop_once(ev) != 0) {
|
||||
talloc_free(smb_krb5);
|
||||
return EINVAL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user