summaryrefslogtreecommitdiff
path: root/source4/auth/kerberos/krb5_init_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth/kerberos/krb5_init_context.c')
-rw-r--r--source4/auth/kerberos/krb5_init_context.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index 2ca364032b..7e75029363 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
Wrapper for krb5_init_context
@@ -10,12 +10,12 @@
it under the terms of the GNU General Public License as published by
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,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, see <http://www.gnu.org/licenses/>.
*/
@@ -41,7 +41,7 @@ struct smb_krb5_socket {
NTSTATUS status;
DATA_BLOB request, reply;
-
+
struct packet_context *packet;
size_t partial_read;
@@ -51,7 +51,7 @@ struct smb_krb5_socket {
static krb5_error_code smb_krb5_context_destroy_1(struct smb_krb5_context *ctx)
{
- krb5_free_context(ctx->krb5_context);
+ krb5_free_context(ctx->krb5_context);
return 0;
}
@@ -88,30 +88,30 @@ static void smb_krb5_socket_recv(struct smb_krb5_socket *smb_krb5)
talloc_free(tmp_ctx);
return;
}
-
+
blob = data_blob_talloc(tmp_ctx, NULL, dsize);
if (blob.data == NULL && dsize != 0) {
smb_krb5->status = NT_STATUS_NO_MEMORY;
talloc_free(tmp_ctx);
return;
}
-
+
smb_krb5->status = socket_recv(smb_krb5->sock, blob.data, blob.length, &nread);
if (!NT_STATUS_IS_OK(smb_krb5->status)) {
talloc_free(tmp_ctx);
return;
}
blob.length = nread;
-
+
if (nread == 0) {
smb_krb5->status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
talloc_free(tmp_ctx);
return;
}
-
- DEBUG(2,("Received smb_krb5 packet of length %d\n",
+
+ DEBUG(2,("Received smb_krb5 packet of length %d\n",
(int)blob.length));
-
+
talloc_steal(smb_krb5, blob.data);
smb_krb5->reply = blob;
talloc_free(tmp_ctx);
@@ -130,7 +130,7 @@ static NTSTATUS smb_krb5_full_packet(void *private_data, DATA_BLOB data)
/*
handle request timeouts
*/
-static void smb_krb5_request_timeout(struct tevent_context *event_ctx,
+static void smb_krb5_request_timeout(struct tevent_context *event_ctx,
struct tevent_timer *te, struct timeval t,
void *private_data)
{
@@ -153,12 +153,12 @@ static void smb_krb5_socket_send(struct smb_krb5_socket *smb_krb5)
NTSTATUS status;
size_t len;
-
+
len = smb_krb5->request.length;
status = socket_send(smb_krb5->sock, &smb_krb5->request, &len);
if (!NT_STATUS_IS_OK(status)) return;
-
+
TEVENT_FD_READABLE(smb_krb5->fde);
TEVENT_FD_NOT_WRITEABLE(smb_krb5->fde);
@@ -232,7 +232,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
return ENOMEM;
}
smb_krb5->hi = hi;
-
+
switch (a->ai_family) {
case PF_INET:
name = "ipv4";
@@ -246,7 +246,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
talloc_free(smb_krb5);
return EINVAL;
}
-
+
status = NT_STATUS_INVALID_PARAMETER;
switch (hi->proto) {
case KRB5_KRBHST_UDP:
@@ -265,8 +265,8 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
}
talloc_steal(smb_krb5, smb_krb5->sock);
-
- remote_addr = socket_address_from_sockaddr(smb_krb5, a->ai_addr, a->ai_addrlen);
+
+ remote_addr = socket_address_from_sockaddr(smb_krb5, a->ai_addr, a->ai_addrlen);
if (!remote_addr) {
talloc_free(smb_krb5);
continue;
@@ -351,7 +351,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
return ret;
}
talloc_free(smb_krb5);
-
+
break;
}
if (a) {
@@ -360,18 +360,18 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
return KRB5_KDC_UNREACH;
}
-krb5_error_code smb_krb5_init_context(void *parent_ctx,
+krb5_error_code smb_krb5_init_context(void *parent_ctx,
struct tevent_context *ev,
struct loadparm_context *lp_ctx,
- struct smb_krb5_context **smb_krb5_context)
+ struct smb_krb5_context **smb_krb5_context)
{
krb5_error_code ret;
TALLOC_CTX *tmp_ctx;
char **config_files;
const char *config_file, *realm;
-
+
initialize_krb5_error_table();
-
+
tmp_ctx = talloc_new(parent_ctx);
*smb_krb5_context = talloc(tmp_ctx, struct smb_krb5_context);
@@ -382,7 +382,7 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
ret = krb5_init_context(&(*smb_krb5_context)->krb5_context);
if (ret) {
- DEBUG(1,("krb5_init_context failed (%s)\n",
+ DEBUG(1,("krb5_init_context failed (%s)\n",
error_message(ret)));
talloc_free(tmp_ctx);
return ret;
@@ -395,31 +395,31 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
talloc_free(tmp_ctx);
return ENOMEM;
}
-
+
/* Use our local krb5.conf file by default */
ret = krb5_prepend_config_files_default(config_file == NULL?"":config_file, &config_files);
if (ret) {
- DEBUG(1,("krb5_prepend_config_files_default failed (%s)\n",
+ DEBUG(1,("krb5_prepend_config_files_default failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;
}
- ret = krb5_set_config_files((*smb_krb5_context)->krb5_context,
+ ret = krb5_set_config_files((*smb_krb5_context)->krb5_context,
config_files);
krb5_free_config_files(config_files);
if (ret) {
- DEBUG(1,("krb5_set_config_files failed (%s)\n",
+ DEBUG(1,("krb5_set_config_files failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;
}
-
+
realm = lp_realm(lp_ctx);
if (realm != NULL) {
ret = krb5_set_default_realm((*smb_krb5_context)->krb5_context, realm);
if (ret) {
- DEBUG(1,("krb5_set_default_realm failed (%s)\n",
+ DEBUG(1,("krb5_set_default_realm failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;
@@ -428,9 +428,9 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
/* TODO: Should we have a different name here? */
ret = krb5_initlog((*smb_krb5_context)->krb5_context, "Samba", &(*smb_krb5_context)->logf);
-
+
if (ret) {
- DEBUG(1,("krb5_initlog failed (%s)\n",
+ DEBUG(1,("krb5_initlog failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;
@@ -438,10 +438,10 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
talloc_set_destructor(*smb_krb5_context, smb_krb5_context_destroy_2);
- ret = krb5_addlog_func((*smb_krb5_context)->krb5_context, (*smb_krb5_context)->logf, 0 /* min */, -1 /* max */,
+ ret = krb5_addlog_func((*smb_krb5_context)->krb5_context, (*smb_krb5_context)->logf, 0 /* min */, -1 /* max */,
smb_krb5_debug_wrapper, smb_krb5_debug_close, NULL);
if (ret) {
- DEBUG(1,("krb5_addlog_func failed (%s)\n",
+ DEBUG(1,("krb5_addlog_func failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;
@@ -449,11 +449,11 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
krb5_set_warn_dest((*smb_krb5_context)->krb5_context, (*smb_krb5_context)->logf);
/* Set use of our socket lib */
- ret = krb5_set_send_to_kdc_func((*smb_krb5_context)->krb5_context,
- smb_krb5_send_and_recv_func,
+ ret = krb5_set_send_to_kdc_func((*smb_krb5_context)->krb5_context,
+ smb_krb5_send_and_recv_func,
ev);
if (ret) {
- DEBUG(1,("krb5_set_send_recv_func failed (%s)\n",
+ DEBUG(1,("krb5_set_send_recv_func failed (%s)\n",
smb_get_krb5_error_message((*smb_krb5_context)->krb5_context, ret, tmp_ctx)));
talloc_free(tmp_ctx);
return ret;