daemon: virNetSASLContext: store tcpMinSSF

Store the minimum SSF value for TCP connections
in virNetSASLContext and introduce a getter for it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2019-06-03 15:50:06 +02:00
parent de7288ae97
commit 5e3a0bb57c
5 changed files with 18 additions and 4 deletions

View File

@ -7,6 +7,7 @@ virNetClientSetSASLSession;
# rpc/virnetsaslcontext.h
virNetSASLContextCheckIdentity;
virNetSASLContextGetTCPMinSSF;
virNetSASLContextNewClient;
virNetSASLContextNewServer;
virNetSASLSessionClientStart;

View File

@ -405,7 +405,8 @@ daemonSetupNetworking(virNetServer *srv,
#if WITH_SASL
if (virNetServerNeedsAuth(srv, REMOTE_AUTH_SASL) &&
!(saslCtxt = virNetSASLContextNewServer(
(const char *const*)config->sasl_allowed_username_list)))
(const char *const*)config->sasl_allowed_username_list,
56)))
return -1;
#endif

View File

@ -3695,7 +3695,7 @@ remoteDispatchAuthSaslInit(virNetServer *server G_GNUC_UNUSED,
else
/* Plain TCP, better get an SSF layer */
virNetSASLSessionSecProps(sasl,
56, /* Good enough to require kerberos */
virNetSASLContextGetTCPMinSSF(saslCtxt),
100000, /* Arbitrary big number */
false); /* No anonymous */

View File

@ -37,6 +37,7 @@ struct _virNetSASLContext {
virObjectLockable parent;
const char *const *usernameACL;
unsigned int tcpMinSSF;
};
struct _virNetSASLSession {
@ -121,7 +122,8 @@ virNetSASLContext *virNetSASLContextNewClient(void)
return ctxt;
}
virNetSASLContext *virNetSASLContextNewServer(const char *const *usernameACL)
virNetSASLContext *virNetSASLContextNewServer(const char *const *usernameACL,
unsigned int tcpMinSSF)
{
virNetSASLContext *ctxt;
@ -133,6 +135,7 @@ virNetSASLContext *virNetSASLContextNewServer(const char *const *usernameACL)
return NULL;
ctxt->usernameACL = usernameACL;
ctxt->tcpMinSSF = tcpMinSSF;
return ctxt;
}
@ -175,6 +178,12 @@ int virNetSASLContextCheckIdentity(virNetSASLContext *ctxt,
}
unsigned int virNetSASLContextGetTCPMinSSF(virNetSASLContext *ctxt)
{
return ctxt->tcpMinSSF;
}
virNetSASLSession *virNetSASLSessionNewClient(virNetSASLContext *ctxt G_GNUC_UNUSED,
const char *service,
const char *hostname,

View File

@ -36,11 +36,14 @@ enum {
};
virNetSASLContext *virNetSASLContextNewClient(void);
virNetSASLContext *virNetSASLContextNewServer(const char *const *usernameACL);
virNetSASLContext *virNetSASLContextNewServer(const char *const *usernameACL,
unsigned int min_ssf);
int virNetSASLContextCheckIdentity(virNetSASLContext *ctxt,
const char *identity);
unsigned int virNetSASLContextGetTCPMinSSF(virNetSASLContext *ctxt);
virNetSASLSession *virNetSASLSessionNewClient(virNetSASLContext *ctxt,
const char *service,
const char *hostname,