コード例 #1
0
ファイル: options.cpp プロジェクト: bagdxk/openafs
void Options_General_OnApply (HWND hDlg)
{
   BOOL fServerLongNamesOld = gr.fServerLongNames;

   gr.fServerLongNames = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_LONGNAMES);

   if (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_PROP))
      gr.fDoubleClickOpens = 0;
   else if (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_OPEN))
      gr.fDoubleClickOpens = 1;
   else // (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_DEPENDS))
      gr.fDoubleClickOpens = 2;

   gr.fOpenMonitors = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_OPENMON);
   gr.fCloseUnmonitors = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_CLOSEUNMON);
   gr.fWarnBadCreds = IsDlgButtonChecked (hDlg, IDC_OPT_WARN_BADCREDS);

   StoreSettings (REGSTR_SETTINGS_BASE, REGSTR_SETTINGS_PATH, REGVAL_SETTINGS, &gr, sizeof(gr), wVerGLOBALS_RESTORED);

   if (fServerLongNamesOld != gr.fServerLongNames)
      {
      AfsClass_RequestLongServerNames (gr.fServerLongNames);

      // repopulate the list of server names.
      UpdateDisplay_Servers (FALSE, NULL, 0);
      }

   if (gr.fWarnBadCreds)
      {
      if (!CheckCredentials (TRUE)) // user needs new creds?
         {
         PostMessage (g.hMain, WM_COMMAND, MAKELONG(M_CREDENTIALS,0), 0);
         }
      }
}
コード例 #2
0
ファイル: WebServer.cpp プロジェクト: outtahere/nzbget
void WebProcessor::Execute()
{
	m_gzip =false;
	m_userAccess = uaControl;
	m_authInfo[0] = '\0';
	m_authToken[0] = '\0';

	ParseHeaders();

	if (m_httpMethod == hmPost && m_contentLen <= 0)
	{
		error("Invalid-request: content length is 0");
		return;
	}

	if (m_httpMethod == hmOptions)
	{
		SendOptionsResponse();
		return;
	}

	ParseUrl();

	if (!CheckCredentials())
	{
		SendAuthResponse();
		return;
	}

	if (m_httpMethod == hmPost)
	{
		// reading http body (request content)
		m_request.Reserve(m_contentLen);
		m_request[m_contentLen] = '\0';

		if (!m_connection->Recv(m_request, m_contentLen))
		{
			error("Invalid-request: could not read data");
			return;
		}
		debug("Request=%s", *m_request);
	}

	debug("request received from %s", m_connection->GetRemoteAddr());

	Dispatch();
}
コード例 #3
0
	/* User is attempting to connect to IRCd */
	virtual int OnUserRegister(User* user) {
		bool checkResult;

		std::string* wnick;
		if (user->GetExt("wantsnick", wnick)) {
			/* Override Allowpattern */
			if ((!allowpattern.empty()) && (InspIRCd::Match(wnick->c_str(),allowpattern))) {
				user->Extend("sqlauthed");
				return 0;
			}
		} else {
			/* Override Allowpattern */
			if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern))) {
				user->Extend("sqlauthed");
				return 0;
			}
		}

		checkResult = CheckCredentials(user);

		if (!checkResult) { return 1; }

		return 0;
	}
コード例 #4
0
ファイル: alert.cpp プロジェクト: bagdxk/openafs
void Alert_EndUpdate (LPIDENT lpi, LPSERVER lpServer)
{
   // If we just updated some aggregate, fileset or service, then the
   // associated server's secondary alerts are probably out-of-date.
   // Update them.
   //
   if (lpServer != NULL)
      {
      LPOBJECTALERTS lpoaServer = Alert_GetObjectAlerts (lpServer->GetIdentifier());
      LPOBJECTALERTS lpoaChild  = Alert_GetObjectAlerts (lpi);

      if (lpoaServer)
         {
         for (size_t iAlert = 0; iAlert < lpoaServer->nAlerts; )
            {
            if ( (lpoaServer->aAlerts[ iAlert ].alert == alertSECONDARY) &&
                 (lpoaServer->aAlerts[ iAlert ].aiSECONDARY.lpiSecondary == lpi) )
               {
               Alert_RemoveFunc (lpoaServer, iAlert);
               }
            else
               {
               ++iAlert;
               }
            }
         }

      if (lpoaServer && lpoaChild)
         {
         BOOL fNeedBadCredsWarning = FALSE;
         BOOL fHaveBadCredsWarning = FALSE;

         size_t iAlert;
         for (iAlert = 0; iAlert < lpoaServer->nAlerts; ++iAlert)
            {
            if (lpoaServer->aAlerts[ iAlert ].alert == alertSECONDARY)
               {
               ALERT alert = Alert_GetAlert (lpoaServer->aAlerts[ iAlert ].aiSECONDARY.lpiSecondary,
                                             lpoaServer->aAlerts[ iAlert ].aiSECONDARY.iSecondary);
               if (alert == alertNO_SVRENT)
                  fNeedBadCredsWarning = TRUE;
               }
            }
         for (iAlert = 0; iAlert < lpoaChild->nAlerts; ++iAlert)
            {
            if (lpoaChild->aAlerts[ iAlert ].alert == alertNO_SVRENT)
               fNeedBadCredsWarning = TRUE;
            }
         if (lpoaServer->nAlerts &&
             lpoaServer->aAlerts[ 0 ].alert == alertBADCREDS)
            {
            fHaveBadCredsWarning = TRUE;
            }

         if (fNeedBadCredsWarning)
            {
            fNeedBadCredsWarning = !CheckCredentials (FALSE);
            }

         if (fHaveBadCredsWarning && !fNeedBadCredsWarning)
            {
            Alert_RemoveFunc (lpoaServer, 0);
            }
         else if (fNeedBadCredsWarning && !fHaveBadCredsWarning)
            {
            for (iAlert = min( lpoaServer->nAlerts, nAlertsMAX-1 );
                 iAlert > 0;
                 --iAlert)
               {
               memcpy (&lpoaServer->aAlerts[ iAlert ], &lpoaServer->aAlerts[ iAlert-1 ], sizeof(ALERTINFO));
               }
            lpoaServer->aAlerts[0].alert = alertBADCREDS;
            lpoaServer->nAlerts = min( nAlertsMAX, lpoaServer->nAlerts+1 );
            }

         for (iAlert = 0; iAlert < lpoaChild->nAlerts; ++iAlert)
            {
            if (lpoaServer->nAlerts < nAlertsMAX)
               {
               lpoaServer->aAlerts[ lpoaServer->nAlerts ].alert = alertSECONDARY;
               lpoaServer->aAlerts[ lpoaServer->nAlerts ].aiSECONDARY.lpiSecondary = lpi;
               lpoaServer->aAlerts[ lpoaServer->nAlerts ].aiSECONDARY.iSecondary = iAlert;
               lpoaServer->nAlerts ++;
               }
            }
         }

      lpServer->Close();
      }
}