mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +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
|
# Start SUBSYSTEM KERBEROS
|
||||||
[SUBSYSTEM::KERBEROS]
|
[SUBSYSTEM::KERBEROS]
|
||||||
PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 NDR_KRB5PAC samba_socket LIBCLI_RESOLVE
|
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
|
# End SUBSYSTEM KERBEROS
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "system/kerberos.h"
|
#include "system/kerberos.h"
|
||||||
|
#include <tevent.h>
|
||||||
#include "auth/kerberos/kerberos.h"
|
#include "auth/kerberos/kerberos.h"
|
||||||
#include "lib/socket/socket.h"
|
#include "lib/socket/socket.h"
|
||||||
#include "lib/stream/packet.h"
|
#include "lib/stream/packet.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
#include "lib/events/events.h"
|
|
||||||
#include "param/param.h"
|
#include "param/param.h"
|
||||||
#include "libcli/resolve/resolve.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;
|
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;
|
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);
|
struct smb_krb5_socket *smb_krb5 = talloc_get_type(private, struct smb_krb5_socket);
|
||||||
switch (smb_krb5->hi->proto) {
|
switch (smb_krb5->hi->proto) {
|
||||||
case KRB5_KRBHST_UDP:
|
case KRB5_KRBHST_UDP:
|
||||||
if (flags & EVENT_FD_READ) {
|
if (flags & TEVENT_FD_READ) {
|
||||||
smb_krb5_socket_recv(smb_krb5);
|
smb_krb5_socket_recv(smb_krb5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (flags & EVENT_FD_WRITE) {
|
if (flags & TEVENT_FD_WRITE) {
|
||||||
smb_krb5_socket_send(smb_krb5);
|
smb_krb5_socket_send(smb_krb5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* not reached */
|
/* not reached */
|
||||||
return;
|
return;
|
||||||
case KRB5_KRBHST_TCP:
|
case KRB5_KRBHST_TCP:
|
||||||
if (flags & EVENT_FD_READ) {
|
if (flags & TEVENT_FD_READ) {
|
||||||
packet_recv(smb_krb5->packet);
|
packet_recv(smb_krb5->packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (flags & EVENT_FD_WRITE) {
|
if (flags & TEVENT_FD_WRITE) {
|
||||||
packet_queue_run(smb_krb5->packet);
|
packet_queue_run(smb_krb5->packet);
|
||||||
return;
|
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);
|
tevent_fd_set_close_fn(smb_krb5->fde, socket_tevent_fd_close_fn);
|
||||||
socket_set_flags(smb_krb5->sock, SOCKET_FLAG_NOCLOSE);
|
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),
|
timeval_current_ofs(timeout, 0),
|
||||||
smb_krb5_request_timeout, smb_krb5);
|
smb_krb5_request_timeout, smb_krb5);
|
||||||
|
|
||||||
|
|
||||||
smb_krb5->status = NT_STATUS_OK;
|
smb_krb5->status = NT_STATUS_OK;
|
||||||
smb_krb5->reply = data_blob(NULL, 0);
|
smb_krb5->reply = data_blob(NULL, 0);
|
||||||
|
|
||||||
switch (hi->proto) {
|
switch (hi->proto) {
|
||||||
case KRB5_KRBHST_UDP:
|
case KRB5_KRBHST_UDP:
|
||||||
EVENT_FD_WRITEABLE(smb_krb5->fde);
|
TEVENT_FD_WRITEABLE(smb_krb5->fde);
|
||||||
smb_krb5->request = send_blob;
|
smb_krb5->request = send_blob;
|
||||||
break;
|
break;
|
||||||
case KRB5_KRBHST_TCP:
|
case KRB5_KRBHST_TCP:
|
||||||
@ -330,7 +329,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
while ((NT_STATUS_IS_OK(smb_krb5->status)) && !smb_krb5->reply.length) {
|
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);
|
talloc_free(smb_krb5);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user