projects
/
cyrus-sasl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e881473
)
add cb test
author
Luke Howard
<lukeh@padl.com>
Sun, 26 Sep 2010 09:37:16 +0000
(11:37 +0200)
committer
Luke Howard
<lukeh@padl.com>
Sun, 26 Sep 2010 09:37:16 +0000
(11:37 +0200)
sample/client.c
patch
|
blob
|
history
sample/server.c
patch
|
blob
|
history
diff --git
a/sample/client.c
b/sample/client.c
index
0ddb16c
..
8140df6
100644
(file)
--- a/
sample/client.c
+++ b/
sample/client.c
@@
-108,7
+108,9
@@
static int simple(void *context __attribute__((unused)),
const char **result,
unsigned *len)
{
const char **result,
unsigned *len)
{
- static char buf[1024];
+ static char bufU[1024];
+ static char bufA[1024];
+ char *b;
/* paranoia check */
if (! result)
/* paranoia check */
if (! result)
@@
-117,18
+119,20
@@
static int simple(void *context __attribute__((unused)),
switch (id) {
case SASL_CB_USER:
printf("please enter an authorization id: ");
switch (id) {
case SASL_CB_USER:
printf("please enter an authorization id: ");
+ b = bufU;
break;
case SASL_CB_AUTHNAME:
printf("please enter an authentication id: ");
break;
case SASL_CB_AUTHNAME:
printf("please enter an authentication id: ");
+ b = bufA;
break;
default:
return SASL_BADPARAM;
}
break;
default:
return SASL_BADPARAM;
}
- fgets(b
uf, sizeof buf
, stdin);
- chop(b
uf
);
- *result = b
uf
;
- if (len) *len = strlen(b
uf
);
+ fgets(b
, 1024
, stdin);
+ chop(b);
+ *result = b;
+ if (len) *len = strlen(b);
return SASL_OK;
}
return SASL_OK;
}
@@
-337,6
+341,7
@@
int main(int argc, char *argv[])
int salen;
int niflags, error;
struct sockaddr_storage local_ip, remote_ip;
int salen;
int niflags, error;
struct sockaddr_storage local_ip, remote_ip;
+ sasl_channel_bindings cb;
while ((c = getopt(argc, argv, "p:s:m:")) != EOF) {
switch(c) {
while ((c = getopt(argc, argv, "p:s:m:")) != EOF) {
switch(c) {
@@
-415,12
+420,19
@@
int main(int argc, char *argv[])
r = sasl_client_new(service, host, localaddr, remoteaddr, NULL, 0, &conn);
if (r != SASL_OK) saslfail(r, "allocating connection state");
r = sasl_client_new(service, host, localaddr, remoteaddr, NULL, 0, &conn);
if (r != SASL_OK) saslfail(r, "allocating connection state");
+ cb.type = "sasl-sample";
+ cb.data = "this is a test of channel bindings";
+ cb.len = strlen(cb.data);
+
+ sasl_setprop(conn, SASL_CHANNEL_BINDINGS, &cb);
+
/* set external properties here
sasl_setprop(conn, SASL_SSF_EXTERNAL, &extprops); */
/* set required security properties here
sasl_setprop(conn, SASL_SEC_PROPS, &secprops); */
/* set external properties here
sasl_setprop(conn, SASL_SSF_EXTERNAL, &extprops); */
/* set required security properties here
sasl_setprop(conn, SASL_SEC_PROPS, &secprops); */
+
in = fdopen(fd, "r");
out = fdopen(fd, "w");
in = fdopen(fd, "r");
out = fdopen(fd, "w");
diff --git
a/sample/server.c
b/sample/server.c
index
d34fb7b
..
6eaabd8
100644
(file)
--- a/
sample/server.c
+++ b/
sample/server.c
@@
-368,6
+368,7
@@
int main(int argc, char *argv[])
int nfds, fd = -1;
FILE *in, *out;
fd_set readfds;
int nfds, fd = -1;
FILE *in, *out;
fd_set readfds;
+ sasl_channel_bindings cb;
FD_ZERO(&readfds);
for (i = 1; i <= l[0]; i++)
FD_ZERO(&readfds);
for (i = 1; i <= l[0]; i++)
@@
-439,6
+440,12
@@
int main(int argc, char *argv[])
NULL, 0, &conn);
if (r != SASL_OK) saslfail(r, "allocating connection state");
NULL, 0, &conn);
if (r != SASL_OK) saslfail(r, "allocating connection state");
+ cb.type = "sasl-sample";
+ cb.data = "this is a test of channel bindings";
+ cb.len = strlen(cb.data);
+
+ sasl_setprop(conn, SASL_CHANNEL_BINDINGS, &cb);
+
/* set external properties here
sasl_setprop(conn, SASL_SSF_EXTERNAL, &extprops); */
/* set external properties here
sasl_setprop(conn, SASL_SSF_EXTERNAL, &extprops); */