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 "auth/auth.h"
+#include "auth/credentials/credentials.h"
+#include "auth/gensec/gensec.h"
+#include "auth/gensec/gensec_proto.h"
#include "lib/socket/socket.h"
#include <sasl/sasl.h>
return SASL_NOMEM;
}
secret->len = strlen(password);
- safe_strcpy(secret->data, password, secret->len+1);
+ safe_strcpy((char*)secret->data, password, secret->len+1);
*psecret = secret;
return SASL_OK;
}
static int gensec_sasl_dispose(struct gensec_sasl_state *gensec_sasl_state)
{
sasl_dispose(&gensec_sasl_state->conn);
- return 0;
+ return SASL_OK;
}
static NTSTATUS gensec_sasl_client_start(struct gensec_security *gensec_security)
sasl_ret = sasl_client_start(gensec_sasl_state->conn, gensec_security->ops->sasl_name,
NULL, &out_data, &out_len, &mech);
} else {
- sasl_ret = sasl_client_step(gensec_sasl_state->conn,
- in.data, in.length, NULL, &out_data, &out_len);
+ sasl_ret = sasl_client_step(gensec_sasl_state->conn,
+ (char*)in.data, in.length, NULL,
+ &out_data, &out_len);
}
if (sasl_ret == SASL_OK || sasl_ret == SASL_CONTINUE) {
*out = data_blob_talloc(out_mem_ctx, out_data, out_len);
const char *out_data;
unsigned int out_len;
- int sasl_ret = sasl_decode(gensec_sasl_state->conn,
- in->data, in->length, &out_data, &out_len);
+ int sasl_ret = sasl_decode(gensec_sasl_state->conn,
+ (char*)in->data, in->length, &out_data,
+ &out_len);
if (sasl_ret == SASL_OK) {
*out = data_blob_talloc(out_mem_ctx, out_data, out_len);
*len_processed = in->length;
return sasl_nt_status(sasl_ret);
}
+
static NTSTATUS gensec_sasl_wrap_packets(struct gensec_security *gensec_security,
TALLOC_CTX *out_mem_ctx,
const DATA_BLOB *in,
const char *out_data;
unsigned int out_len;
- int sasl_ret = sasl_encode(gensec_sasl_state->conn,
- in->data, in->length, &out_data, &out_len);
+ int sasl_ret = sasl_encode(gensec_sasl_state->conn,
+ (char*)in->data, in->length, &out_data,
+ &out_len);
if (sasl_ret == SASL_OK) {
*out = data_blob_talloc(out_mem_ctx, out_data, out_len);
*len_processed = in->length;
}
/* Try to figure out what features we actually got on the connection */
-static BOOL gensec_sasl_have_feature(struct gensec_security *gensec_security,
+static bool gensec_sasl_have_feature(struct gensec_security *gensec_security,
uint32_t feature)
{
struct gensec_sasl_state *gensec_sasl_state = talloc_get_type(gensec_security->private_data,
struct gensec_sasl_state);
sasl_ssf_t ssf;
- int sasl_ret = sasl_getprop(gensec_sasl_state->conn, SASL_SSF, &ssf);
+ int sasl_ret = sasl_getprop(gensec_sasl_state->conn, SASL_SSF,
+ (const void**)&ssf);
if (sasl_ret != SASL_OK) {
- return False;
+ return false;
}
if (feature & GENSEC_FEATURE_SIGN) {
if (ssf == 0) {
- return False;
+ return false;
}
if (ssf >= 1) {
- return True;
+ return true;
}
}
if (feature & GENSEC_FEATURE_SEAL) {
if (ssf <= 1) {
- return False;
+ return false;
}
if (ssf > 1) {
- return True;
+ return true;
}
}
- return False;
+ return false;
}
/* This could in theory work with any SASL mech */
.wrap_packets = gensec_sasl_wrap_packets,
.unwrap_packets = gensec_sasl_unwrap_packets,
.have_feature = gensec_sasl_have_feature,
- .enabled = False,
+ .enabled = true,
+ .priority = GENSEC_SASL
};
int gensec_sasl_log(void *context,
NTSTATUS gensec_sasl_init(void)
{
NTSTATUS ret;
- int sasl_ret, i;
+ int sasl_ret;
+#if 0
+ int i;
const char **sasl_mechs;
+#endif
static const sasl_callback_t callbacks[] = {
{
if (oldmech) {
continue;
}
- newmech = talloc(NULL, struct gensec_security_ops);
+ newmech = talloc(talloc_autofree_context(), struct gensec_security_ops);
if (!newmech) {
return NT_STATUS_NO_MEMORY;
}