Example #1
0
DWORD
LsaRpcReadRegistry(
    PLSA_RPC_SERVER *ppRpcSrvList
    )
{
    DWORD dwError = 0;

    PLSA_CONFIG_REG pReg = NULL;
    PSTR pszServers = NULL;
    PSTR pszServerKey = NULL;

    PSTR pszServer = NULL;

    BAIL_ON_INVALID_POINTER(ppRpcSrvList);

    dwError = LsaOpenConfig(
                "Services\\lsass\\Parameters\\RPCServers",
                "Policy\\Services\\lsass\\Parameters\\RPCServers",
                &pReg);
    BAIL_ON_LSA_ERROR(dwError);

    if (pReg == NULL)
    {
        goto error;
    }

    dwError = LsaReadConfigMultiString(
                pReg,
                "LoadOrder",
                FALSE,
                &pszServers,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    LsaCloseConfig(pReg);
    pReg = NULL;

    if (LW_IS_NULL_OR_EMPTY_STR(pszServers) )
    {
        goto error;
    }

    pszServer = pszServers;
    while (pszServer != NULL && *pszServer != '\0')
    {
        dwError = LwAllocateStringPrintf(
                    &pszServerKey,
                    "Services\\lsass\\Parameters\\RpcServers\\%s",
                    pszServer);
        BAIL_ON_LSA_ERROR(dwError);

        dwError = LsaRpcReadServer(
                    pszServer,
                    pszServerKey,
                    ppRpcSrvList);
        BAIL_ON_LSA_ERROR(dwError);

        LW_SAFE_FREE_STRING(pszServerKey);
        pszServer = pszServer + strlen(pszServer) + 1;
    }

cleanup:
    LW_SAFE_FREE_STRING(pszServers);
    LW_SAFE_FREE_STRING(pszServerKey);

    LsaCloseConfig(pReg);
    pReg = NULL;

    return dwError;

error:
    goto cleanup;
}
Example #2
0
DWORD
WkssSrvReadRegistry(
    PWKSS_SRV_CONFIG pConfig
    )
{
    DWORD dwError = 0;

    PLSA_CONFIG_REG pReg = NULL;

    dwError = LsaOpenConfig(
                "Services\\lsass\\Parameters\\RPCServers\\wkssvc",
                "Policy\\Services\\lsass\\Parameters\\RPCServers\\wkssvc",
                &pReg);
    BAIL_ON_LSA_ERROR(dwError);

    if (!pReg)
    {
        goto error;
    }

    dwError = LsaReadConfigString(
                pReg,
                "LpcSocketPath",
                FALSE,
                &pConfig->pszLpcSocketPath,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaReadConfigBoolean(
                pReg,
                "RegisterTcpIp",
                TRUE,
                &pConfig->bRegisterTcpIp);
    BAIL_ON_LSA_ERROR(dwError);

    LsaCloseConfig(pReg);
    pReg = NULL;

    dwError = LsaOpenConfig(
                "Services\\lsass\\Parameters\\RPCServers\\lsarpc",
                "Policy\\Services\\lsass\\Parameters\\RPCServers\\lsarpc",
                &pReg);
    BAIL_ON_LSA_ERROR(dwError);

    if (!pReg)
    {
        goto error;
    }

    dwError = LsaReadConfigString(
                pReg,
                "LpcSocketPath",
                FALSE,
                &pConfig->pszLsaLpcSocketPath,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    LsaCloseConfig(pReg);
    pReg = NULL;

cleanup:
    return dwError;

error:
    LsaCloseConfig(pReg);
    pReg = NULL;

    goto cleanup;
}
Example #3
0
static
DWORD
LsaRpcReadServer(
    PCSTR   pszServerName,
    PCSTR   pszServerKey,
    PLSA_RPC_SERVER *ppRpcSrvList
    )
{
    DWORD dwError = 0;

    PLSA_CONFIG_REG pReg = NULL;

    PLSA_RPC_SERVER pRpcSrv = NULL;

    PSTR pszPath = NULL;

    dwError = LsaOpenConfig(
                pszServerKey,
                pszServerKey,
                &pReg);
    BAIL_ON_LSA_ERROR(dwError);

    if (pReg == NULL)
    {
        goto error;
    }

    dwError = LsaReadConfigString(
                pReg,
                "Path",
                FALSE,
                &pszPath,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    if(!LW_IS_NULL_OR_EMPTY_STR(pszPath))
    {
        dwError = LwAllocateMemory(
                    sizeof(LSA_RPC_SERVER),
                    (PVOID*)&pRpcSrv);
        BAIL_ON_LSA_ERROR(dwError);

        pRpcSrv->pszSrvLibPath = pszPath;
        pszPath = NULL;

        dwError = LwAllocateString(pszServerName, &pRpcSrv->pszName);
        BAIL_ON_LSA_ERROR(dwError);

        LsaSrvAppendRpcServerList(pRpcSrv, ppRpcSrvList);
        pRpcSrv = NULL;
    }

cleanup:

    LsaCloseConfig(pReg);
    pReg = NULL;

    return dwError;

error:
    LW_SAFE_FREE_STRING(pszPath);
    if (pRpcSrv) 
    {
        LsaSrvFreeRpcServer(pRpcSrv);
        pRpcSrv = NULL;
    }

    goto cleanup;
}
Example #4
0
DWORD
SamrSrvReadRegistry(
    PSAMR_SRV_CONFIG pConfig
    )
{
    DWORD dwError = 0;

    PLSA_CONFIG_REG pReg = NULL;

    dwError = LsaOpenConfig(
            "Services\\lsass\\Parameters\\RPCServers\\samr",
            "Policy\\Services\\lsass\\Parameters\\RPCServers\\samr",
            &pReg);
    BAIL_ON_LSA_ERROR(dwError);

    if (!pReg)
    {
        goto error;
    }

    dwError = LsaReadConfigString(
                pReg,
                "LpcSocketPath",
                FALSE,
                &pConfig->pszLpcSocketPath,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaReadConfigString(
                pReg,
                "LoginShellTemplate",
                TRUE,
                &pConfig->pszDefaultLoginShell,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaReadConfigString(
                pReg,
                "HomeDirPrefix",
                TRUE,
                &pConfig->pszHomedirPrefix,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaReadConfigString(
                pReg,
                "HomeDirTemplate",
                TRUE,
                &pConfig->pszHomedirTemplate,
                NULL);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaReadConfigBoolean(
                pReg,
                "RegisterTcpIp",
                TRUE,
                &pConfig->bRegisterTcpIp);
    BAIL_ON_LSA_ERROR(dwError);

cleanup:
    LsaCloseConfig(pReg);
    pReg = NULL;

    return dwError;

error:
    goto cleanup;
}