summaryrefslogtreecommitdiffstats
path: root/plugins/imgssapi/imgssapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/imgssapi/imgssapi.c')
-rw-r--r--plugins/imgssapi/imgssapi.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index 4e3a70ab..15d994cc 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -72,6 +72,7 @@ MODULE_CNFNAME("imgssapi")
/* some forward definitions - they may go away when we no longer include imtcp.c */
static rsRetVal addGSSListener(void __attribute__((unused)) *pVal, uchar *pNewVal);
+static rsRetVal actGSSListener(uchar *port);
static int TCPSessGSSInit(void);
static void TCPSessGSSClose(tcps_sess_t* pSess);
static rsRetVal TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len, ssize_t *);
@@ -90,6 +91,7 @@ DEFobjCurrIf(glbl)
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL;
+static uchar *srvPort;
/* our usr structure for the tcpsrv object */
typedef struct gsssrv_s {
@@ -317,6 +319,16 @@ static rsRetVal
addGSSListener(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
DEFiRet;
+
+ srvPort = pNewVal;
+
+ RETiRet;
+}
+
+static rsRetVal
+actGSSListener(uchar *port)
+{
+ DEFiRet;
gsssrv_t *pGSrv;
if(pOurTcpsrv == NULL) {
@@ -340,7 +352,7 @@ addGSSListener(void __attribute__((unused)) *pVal, uchar *pNewVal)
CHKiRet(tcpsrv.SetCBOnRegularClose(pOurTcpsrv, onRegularClose));
CHKiRet(tcpsrv.SetCBOnErrClose(pOurTcpsrv, onErrClose));
CHKiRet(tcpsrv.SetInputName(pOurTcpsrv, UCHAR_CONSTANT("imgssapi")));
- tcpsrv.configureTCPListen(pOurTcpsrv, pNewVal, 1);
+ tcpsrv.configureTCPListen(pOurTcpsrv, port, 1);
CHKiRet(tcpsrv.ConstructFinalize(pOurTcpsrv));
}
@@ -676,6 +688,11 @@ ENDfreeCnf
*/
BEGINrunInput
CODESTARTrunInput
+ /* This will fail if the priviledges are dropped. Should be
+ * moved to the '*activateCnfPrePrivDrop' section eventually.
+ */
+ actGSSListener(srvPort);
+
iRet = tcpsrv.Run(pOurTcpsrv);
ENDrunInput
@@ -683,7 +700,7 @@ ENDrunInput
/* initialize and return if will run or not */
BEGINwillRun
CODESTARTwillRun
- if(pOurTcpsrv == NULL)
+ if(srvPort == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
net.PrintAllowedSenders(2); /* TCP */