This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "system/network.h"
#include "lib/events/events.h"
#include "roken.h"
+#include "param/param.h"
/*
context structure for operations on cldap packets
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_WRITE) {
- smb_krb5_socket_send(smb_krb5);
- }
if (flags & EVENT_FD_READ) {
smb_krb5_socket_recv(smb_krb5);
+ return;
}
- break;
+ if (flags & EVENT_FD_WRITE) {
+ smb_krb5_socket_send(smb_krb5);
+ return;
+ }
+ /* not reached */
+ return;
case KRB5_KRBHST_TCP:
if (flags & EVENT_FD_READ) {
packet_recv(smb_krb5->packet);
+ return;
}
if (flags & EVENT_FD_WRITE) {
packet_queue_run(smb_krb5->packet);
+ return;
}
- break;
+ /* not reached */
+ return;
case KRB5_KRBHST_HTTP:
/* can't happen */
break;
}
talloc_free(remote_addr);
+ /* Setup the FDE, start listening for read events
+ * from the start (otherwise we may miss a socket
+ * drop) and mark as AUTOCLOSE along with the fde */
+
+ /* Ths is equivilant to EVENT_FD_READABLE(smb_krb5->fde) */
smb_krb5->fde = event_add_fd(ev, smb_krb5->sock,
socket_get_fd(smb_krb5->sock),
- EVENT_FD_AUTOCLOSE,
+ EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
smb_krb5_socket_handler, smb_krb5);
/* its now the job of the event layer to close the socket */
socket_set_flags(smb_krb5->sock, SOCKET_FLAG_NOCLOSE);
RSIVAL(smb_krb5->request.data, 0, send_blob.length);
memcpy(smb_krb5->request.data+4, send_blob.data, send_blob.length);
packet_send(smb_krb5->packet, smb_krb5->request);
- EVENT_FD_READABLE(smb_krb5->fde);
break;
case KRB5_KRBHST_HTTP:
talloc_free(smb_krb5);
}
krb5_error_code smb_krb5_init_context(void *parent_ctx,
+ struct event_context *ev,
struct smb_krb5_context **smb_krb5_context)
{
krb5_error_code ret;
TALLOC_CTX *tmp_ctx;
- struct event_context *ev;
char **config_files;
const char *config_file;
}
krb5_set_warn_dest((*smb_krb5_context)->krb5_context, (*smb_krb5_context)->logf);
- ev = event_context_find(*smb_krb5_context);
/* Set use of our socket lib */
ret = krb5_set_send_to_kdc_func((*smb_krb5_context)->krb5_context,
smb_krb5_send_and_recv_func,