Esempio n. 1
0
bool CSSPIHandler::init(const char *protocol /* = NULL */)
{
	HKEY hk;
	
	if(!protocol) 
	{
		if(!InitProtocol("Negotiate") && !InitProtocol("NTLM"))
			return false;
	}
	else
	{
		if(!InitProtocol(protocol))
			return false;
	}

	/* Check for BFS mode */
	m_broken_file_sharing = false;
	if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Control\\Lsa",0,KEY_QUERY_VALUE,&hk))
	{
		DWORD dwType,dwVal,dwLen=sizeof(DWORD);
		if(!RegQueryValueEx(hk,L"ForceGuest",NULL,&dwType,(LPBYTE)&dwVal,&dwLen))
		{
			if(dwVal)
				m_broken_file_sharing = true;
		}
		CloseHandle(hk);
	}
	return true;
}
Esempio n. 2
0
LPXLOPER WINAPI FSExecute(int index, const char* name, LPXLOPER v0, LPXLOPER v1, LPXLOPER v2, LPXLOPER v3, LPXLOPER v4, 
							LPXLOPER v5, LPXLOPER v6, LPXLOPER v7, LPXLOPER v8, LPXLOPER v9, LPXLOPER v10,
							LPXLOPER v11, LPXLOPER v12, LPXLOPER v13, LPXLOPER v14, LPXLOPER v15, LPXLOPER v16,
							LPXLOPER v17, LPXLOPER v18, LPXLOPER v19)
{
	// Attempt connection
	if(!InitProtocol(index)) {
		return g_protocol[index]->getLastError();
	}

	// Exec function
	LPXLOPER xres = g_protocol[index]->execute(name, g_sendCallerInfo, 20, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);

	// Check for error
	if(!g_protocol[index]->isConnected()) {
		if(xres) {
			XLUtil::FreeContents(xres);
			delete xres;
		}
		return g_protocol[index]->getLastError();
	}

	// Log function call
	if(g_debugLogging) {
		XLUtil::LogFunctionCall(g_serverSections[index], name, xres, 20, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
	}

	return xres;
}
Esempio n. 3
0
CIso8583<_Ty>::CIso8583(const _Myt &iso) : m_pIFF(NULL)
{
    InitProtocol();

    if(m_pIFF != NULL)
    {
        char cData[PACK_MAXLEN];
        int iLen=0;

        memcpy(m_pIFF->GetMF(), iso.m_pIFF->GetMF(), sizeof(MsgFmt));

        for(int i = 0; i < m_pIFF->GetMF()->iFieldCnt; i++)
        {
            if(const_cast<_Myt &>(iso).FieldExist(i))
            {
                if(BIN==const_cast<_Myt &>(iso).m_pIFF->GetField(i)->GetDataType())
                {
                    iLen=const_cast<_Myt &>(iso).GetValueByHex(i, (unsigned char *) cData, FIELD_MAXLEN);
                    SetValueByHex(i, (unsigned char *)cData,iLen);
                }else{
                    iLen=const_cast<_Myt &>(iso).GetValueByStr(i, cData, FIELD_MAXLEN);
                    SetValueByStr(i,cData);
                }

            }
        }
        if((iLen = const_cast<_Myt &>(iso).m_pIFF->GetMsgData((unsigned char *)cData, PACK_MAXLEN)) > 0)
        {
            m_pIFF->SetMsgData((unsigned char *)cData, iLen);
        }
    }
}
Esempio n. 4
0
// Initialize Cedar communication module
void InitCedar()
{
	if ((init_cedar_counter++) > 0)
	{
		return;
	}

	// Initialize protocol module
	InitProtocol();
}
Esempio n. 5
0
int CUdpClient::OpenConnect(void)
{
	InitProtocol();

	AddStatusLogWithSynT("UdpClient通道连接socket成功!\n");

	ReadFromConnect(recv_data_);

	return 0;
}
Esempio n. 6
0
CIso8583<_Ty>::CIso8583(unsigned char *pTPDU, unsigned char *pMsgHead) : m_pIFF(NULL)
{
    InitProtocol();

    if(m_pIFF != NULL)
    {
        if(pTPDU)
        {
            memcpy(m_pIFF->GetMF()->cTpdu, pTPDU, m_pIFF->GetMF()->iTpduLen);
        }
        if(pMsgHead)
        {
            memcpy(m_pIFF->GetMF()->cHead, pMsgHead, m_pIFF->GetMF()->iHeadLen);
        }
    }
}
Esempio n. 7
0
/**
 * @fn void InitApplication(unsigned long addr)
 *
 * @brief This function initializes the application. It first sets the application
 *        state, then initializes the protocol, and finally sets the pairing mask.
 *
 * @param addr an unsigned long
 */
void InitApplication(unsigned long addr) 
{
  #ifdef INCLUDE_FLASH_STORAGE
  InitFlashStorage();

  // Verify that a valid application state is stored in flash.
  if((MyFlashStorage.myAppState == HUB) || (MyFlashStorage.myAppState == SENSOR)) {
    // Get application state from flash
    ApplicationState = MyFlashStorage.myAppState;
  } else {
    // Set the default application state.
    SetApplicationState(HUB);
  }
  #endif
  InitProtocol();                                                               // Initialize Protocol 
  SetPairingMask(DEFAULT_PAIRING_MASK);                                         // Set pairing mask
}
Esempio n. 8
0
void initdatabases(void)
{
    if (!init) {
	clr_index();
	working(1, 0, 0);
	set_color(WHITE, BLACK);
	ftnd_mvprintw( 5, 6, "     INIT DATABASES");
	IsDoing("Init Databases");
    }

    config_read();

    InitArchive();
    InitDomain();
    InitFilearea();
    InitFilefind();
    InitFGroup();
    InitFidonetdb();
    InitFidonet();
    InitHatch();
    InitLanguage();
    InitLimits();
    InitMagics();
    InitMsgarea();
    InitMGroup();
    InitModem();
    InitNewfiles();
    InitNGroup();
    InitNodes();
    InitOneline();
    InitProtocol();
    InitService();
    InitTicarea();
    InitTtyinfo();
    InitUsers();
    InitVirus();
    InitRoute();
    InitFDB();
    InitIBC();
    if (!init) {
	clr_index();
    }
}
Esempio n. 9
0
BOOL CxDlgVirtualNodeData::OnInitDialog() 
{
	CDialog::OnInitDialog();
	InitProtocol();
	if (!m_strProtocol.IsEmpty())
	{
		int idx = m_cCombo1.FindStringExact (-1, m_strProtocol);
		if (idx != CB_ERR)
			m_cCombo1.SetCurSel (idx);
	}

	m_cOK.EnableWindow (FALSE);
	if (m_bAlter)
	{
		CString strTitle;
#ifdef	EDBC
		if (!strTitle.LoadString (IDS_ALTER_SERVERDATA_TITLE))
			strTitle = _T("Alter the Definition of Server");
#else
		if (!strTitle.LoadString (IDS_ALTER_NODEDATA_TITLE))
			strTitle = _T("Alter the Definition of Virtual Node");
#endif
		CEdit* pEdit = (CEdit*)GetDlgItem (IDC_MFC_EDIT1);
		pEdit->SetReadOnly();
		pEdit->EnableWindow (FALSE);
		SetWindowText (strTitle);

		m_strOldVNodeName       = m_strVNodeName;
		m_strOldRemoteAddress   = m_strRemoteAddress;
		m_strOldListenAddress   = m_strListenAddress;
		m_bOldPrivate           = m_bPrivate;
		m_strOldProtocol        = m_strProtocol;
		CEdit* pEdit2 = (CEdit*)GetDlgItem (IDC_MFC_EDIT2);
		pEdit2->SetFocus();
		pEdit2->SetSel (0, -1);
		return FALSE;
	}
	return TRUE;  // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE    
}
Esempio n. 10
0
/*
 * Requests the function list from the server and registers each function with excel.
 */
void RegisterFunctions(LPXLOPER xDLL, int index)
{
	if(!InitProtocol(index)) {
		return;
	}

	// Ask the server for a list of functions and register them
	LPXLOPER farr = g_protocol[index]->execute(AF_GET_FUNCTIONS, false, 0);
	int t = farr->xltype & ~(xlbitXLFree | xlbitDLLFree);
	int rows = farr->val.array.rows;
	int cols = farr->val.array.columns;
	if(farr != NULL && t == xltypeMulti && cols == 1 && rows > 0) {
		for(int i = 0; i < rows; i++) {
			LPXLOPER earr = &farr->val.array.lparray[i];
			t = earr->xltype & ~(xlbitXLFree | xlbitDLLFree);
			if(t != xltypeMulti)
				continue;
			char* functionName = XLMap::getString(earr, "functionName");
			char* functionText = XLMap::getString(earr, "functionText");
			char* argumentText = XLMap::getString(earr, "argumentText");
			char* category = XLMap::getString(earr, "category");
			char* shortcutText = XLMap::getString(earr, "shortcutText");
			char* helpTopic = XLMap::getString(earr, "helpTopic");
			char* functionHelp = XLMap::getString(earr, "functionHelp");
			LPXLOPER argumentHelp = XLMap::get(earr, "argumentHelp");
			bool isVolatile = XLMap::getBoolean(earr, "isVolatile");
			if(functionName != NULL) {
				char tmp[MAX_PATH];
				sprintf(tmp, "FS%d", g_functionCount);
				char* argHelp[100];
				int argHelpCount=0;
				if(argumentHelp != NULL) {
					for(int j = 0; j < argumentHelp->val.array.rows; j++) {
						argHelp[argHelpCount++] = argumentHelp->val.array.lparray[j].val.str;
					}
					argHelp[argHelpCount++] = "";
				}
				int size = 10 + argHelpCount;
				static LPXLOPER input[20];
				input[0] = (LPXLOPER FAR) xDLL;
				input[1] = (LPXLOPER FAR) XLUtil::MakeExcelString2(tmp);
				input[2] = (LPXLOPER FAR) XLUtil::MakeExcelString2(isVolatile ? "RPPPPPPPPPPPPPPPPPPPP!" : "RPPPPPPPPPPPPPPPPPPPP");
				input[3] = (LPXLOPER FAR) XLUtil::MakeExcelString3(functionText == NULL ? functionName : functionText);
				input[4] = (LPXLOPER FAR) XLUtil::MakeExcelString3(argumentText);
				input[5] = (LPXLOPER FAR) XLUtil::MakeExcelString2("1");
				input[6] = (LPXLOPER FAR) XLUtil::MakeExcelString3(category);
				input[7] = (LPXLOPER FAR) XLUtil::MakeExcelString3(shortcutText);
				input[8] = (LPXLOPER FAR) XLUtil::MakeExcelString3(helpTopic);
				input[9] = (LPXLOPER FAR) XLUtil::MakeExcelString3(functionHelp);
				for(int j = 0; j < argHelpCount && j < 20; j++) {
					input[10 + j] = (LPXLOPER FAR) XLUtil::MakeExcelString3(argHelp[j]);
				}
				int res = Excel4v(xlfRegister, 0, size, (LPXLOPER FAR*) input);
				for(int j = 1; j < size; j++) {
					free(input[j]);
				}
				if(res == 0) {
					memcpy(tmp, &functionName[1], functionName[0]);
					tmp[functionName[0]] = 0;
					g_functionServer[g_functionCount] = index;
					g_functionNames[g_functionCount++] = strdup(tmp);

					if(g_debugLogging) {
						char* provider = g_serverSections[index];
						if(provider)
							Log::Debug("Registered function (%d) %s for server %s", g_functionCount, tmp, provider);
						else
							Log::Debug("Registered function (%d) %s", g_functionCount, tmp);
					}
				}
			}		
		}

		XLUtil::FreeContents(farr);
	}
}
Esempio n. 11
0
extern int main(int argc, char **argv) {
  GOptionContext *goctx;
  char *command;
  GLProtocol *ctx;

  setlocale(LC_CTYPE, "ja_JP.UTF-8");

  AUTHURI = NULL;
  RPCURI = NULL;
  RESTURI = NULL;
  SESSIONID = NULL;
  RPCID = 0;
  USER = NULL;
  PASS = NULL;
#ifdef USE_SSL
  CERTFILE = NULL;
  KEYFILE = NULL;
  KEYPASS = NULL;
  CAFILE = NULL;
#endif

  goctx = g_option_context_new("");
  g_option_context_add_main_entries(goctx, entries, NULL);
  g_option_context_parse(goctx, &argc, &argv, NULL);

  if (argc < 2) {
    PrintArgError();
    exit(1);
  }

  command = argv[1];

  InitTempDir();
  ctx = InitProtocol(AUTHURI, USER, PASS);
  if (RPCURI != NULL) {
    GLP_SetRPCURI(ctx, RPCURI);
  }
  if (RESTURI != NULL) {
    GLP_SetRESTURI(ctx, RESTURI);
  }
  if (SESSIONID != NULL) {
    GLP_SetSessionID(ctx, SESSIONID);
  }
  if (RPCID != 0) {
    GLP_SetRPCID(ctx, RPCID);
  }
#ifdef USE_SSL
  if (CERTFILE != NULL && KEYFILE != NULL && KEYPASS != NULL &&
      CAFILE != NULL) {
    GLP_SetSSL(ctx, CERTFILE, KEYFILE, KEYPASS, CAFILE);
  }
#endif

  if (!strcmp(command, "start_session")) {
    StartSession(ctx);
  } else if (!strcmp(command, "get_window")) {
    GetWindow(ctx);
  } else if (!strcmp(command, "send_event")) {
    if (argc < 3) {
      fprintf(stderr, "start_session need param.json\n");
      exit(1);
    }
    SendEvent(ctx, argv[2]);
  } else if (!strcmp(command, "end_session")) {
    EndSession(ctx);
  } else if (!strcmp(command, "list_downloads")) {
    ListDownloads(ctx);
  } else if (!strcmp(command, "get_message")) {
    GetMessage(ctx);
  } else {
    PrintArgError();
    exit(1);
  }
  FinalProtocol(ctx);
  return 0;
}