odissey: implement authentication mode 'none'
#include "od_fe.h"
#include "od_auth.h"
+static inline int
+od_authok(od_client_t *client)
+{
+ so_stream_t *stream = &client->stream;
+ so_stream_reset(stream);
+ int rc;
+ rc = so_bewrite_authentication(stream, 0);
+ if (rc == -1)
+ return -1;
+ rc = od_write(client->io, stream);
+ return rc;
+}
+
int od_auth(od_client_t *client)
{
od_pooler_t *pooler = client->pooler;
/* match user scheme */
- od_schemeuser_t *user_scheme;
- user_scheme =
+ od_schemeuser_t *user_scheme =
od_schemeuser_match(&pooler->od->scheme, client->startup.user);
if (user_scheme == NULL) {
/* try to use default user */
user_scheme = pooler->od->scheme.users_default;
if (user_scheme == NULL) {
od_error(&pooler->od->log, client->io,
- "C: user '%s' scheme is not declared",
- client->startup.user);
+ "C: user '%s' not found", client->startup.user);
return -1;
}
}
@@ -62,12 +73,19 @@ int od_auth(od_client_t *client)
return -1;
}
- so_stream_t *stream = &client->stream;
- so_stream_reset(stream);
int rc;
- rc = so_bewrite_authentication(stream, 0);
- if (rc == -1)
- return -1;
- rc = od_write(client->io, stream);
+ switch (user_scheme->auth_mode) {
+ case OD_ANONE:
+ /* no authentication required */
+ rc = od_authok(client);
+ break;
+ case OD_ACLEAR_TEXT:
+ break;
+ case OD_AMD5:
+ break;
+ default:
+ assert(0);
+ break;
+ }
return rc;
}
