void ServicesDb::deleteUser(long userId) { QSqlQuery maps = _exec("SELECT id FROM maps WHERE user_id=:user_id", (qlonglong)userId); // delete all the maps owned by this user while (maps.next()) { long mapId = maps.value(0).toLongLong(); deleteMap(mapId); } _exec("DELETE FROM users WHERE id=:id", (qlonglong)userId); }
int HLR2::_exec(const char *url, const char *payload, unsigned short timeout) { std::string headers; pugi::xml_document doc; return _exec(url, payload, timeout, doc, headers); }
int main() { char *argv[] = {"sh", 0}; if (uio_init() < 0) { goto bad; } int pid = _fork(); if (pid == 0) { if (_exec("/bin/sh", argv) < 0) { goto bad; } } else if (pid < 0) { goto bad; } if (_wait() < 0) goto bad; puts("shell exit.\n"); for (;;); bad: puts("Unresolvable fault, check your rootfs.img :(\n"); /* trigger a genernal protection fault */ __asm__("int $13"); }
bool ServicesDb::_hasTable(QString tableName) { QString sql = "SELECT 1 from pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON " "n.oid = c.relnamespace WHERE c.relname = :name"; QSqlQuery q = _exec(sql, tableName); return q.next(); }
ArrayObject* RegExpObject::match(Stringp subject) { UsesUTF8String utf8Subject(subject); if (!get_global()) { return _exec(subject, utf8Subject); } else { ArrayObject *a = toplevel()->arrayClass->newArray(); int oldLastIndex = m_lastIndex; m_lastIndex = 0; int n = 0; ArrayObject* matchArray; while (true) { int last = m_lastIndex; int matchIndex = 0, matchLen = 0; int startIndex = Utf16ToUtf8Index(subject, utf8Subject, m_lastIndex); matchArray = _exec(subject, utf8Subject, startIndex, matchIndex, matchLen); m_lastIndex = Utf8ToUtf16Index(subject, utf8Subject, matchIndex+matchLen); if ((matchArray == NULL) || (last == m_lastIndex)) break; a->setUintProperty(n++, matchArray->getUintProperty(0)); } if (m_lastIndex == oldLastIndex) { m_lastIndex++; } return a; } }
int svc_add_app(const char *svc_name, const char *pkg_name) { int rc = -1; int cnt = 0; char *_sqlbuf; retvm_if(svc_name == NULL, -1, "Service name is null\n"); retvm_if(pkg_name == NULL, -1, "Package name is null\n"); if (__doubt_sql_injection(svc_name)) return -1; if (_init() < 0) return -1; cnt = __count_with_field(SVC_TBL_NAME, SVC_F_SVCNAME, svc_name, 0); if (cnt == 0) { /* insert */ _D("Inserting (%s, %s)", pkg_name, svc_name); _sqlbuf = sqlite3_mprintf( "INSERT INTO %s (%s,%s) values (\"%s\", \"%s\");", SVC_TBL_NAME, SVC_F_PKGNAME, SVC_F_SVCNAME, pkg_name, svc_name); rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); } else { /* update */ _D("Setting %s for %s", pkg_name, svc_name); _sqlbuf = sqlite3_mprintf( "UPDATE %s SET %s = '%s' where %s = '%s';", SVC_TBL_NAME, SVC_F_PKGNAME, pkg_name, SVC_F_SVCNAME, svc_name); rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); } if (rc < 0) _E("fail to insert or update\n"); __fini(); return rc; }
// コンストラクタ Thread::Thread(HSQUIRRELVM v) : Object(v), _currentTick(0), _fileHandler(NULL), _waitTimeout(-1), _status(THREAD_NONE) { _waitList.initArray(); // 実行 if (sq_gettop(v) >= 3) { _exec(v,3); _entryThread(v); } }
Atom RegExpObject::AS3_exec(Stringp subject) { if (!subject) { subject = core()->knull; } UsesUTF8String utf8Subject(subject); ArrayObject *result = _exec(subject, utf8Subject); return result ? result->atom() : nullStringAtom; }
static int __delete_all(const char *tbl_name) { char *_sqlbuf; int rc; _sqlbuf = sqlite3_mprintf("DELETE FROM %s;", tbl_name); rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); return rc; }
/** * 実行開始 * @param func 実行対象ファンクション。文字列の場合該当スクリプトを読み込む */ SQRESULT Thread::exec(HSQUIRRELVM v) { if (sq_gettop(v) <= 1) { return ERROR_INVALIDPARAM(v); } _exec(v); _entryThread(v); return SQ_OK; }
int main(int argc, char **argv) { static const char * const hello_world = "Hello World!\n"; if ( _write(STDOUT_FILENO, hello_world, strlen(hello_world)) <= 0 ) return EXIT_FAILURE; _write(STDOUT_FILENO, (void *)0xdeadbeef, 20); switch (_fork(FORK_PID|FORK_FD|FORK_FS, NULL, NULL, NULL)) { case -1: _write(STDOUT_FILENO, "Fork failed!\n", 13); break; case 0: _exec("/sbin/cpuhog-b"); break; default: _exec("/sbin/cpuhog-a"); break; } return EXIT_FAILURE; }
bool LocalTransform::exec(const NtgEntity & input, HashStringString params) { qDebug()<<"LocalTransform::exec"; if( _status == Ntg::Running) { qCritical("LocalTransform%s already running ! Not doing anything.", qPrintable(objectName())); return 0; } _reset(); if( ! _model.inputTypes.contains(input.type) ) { QString err("Received input type \"%1\" is not handled by transform \"%2\"!"); _setError(Ntg::InvalidInputError, err.arg(input.type).arg(_model.name)); return 0; } foreach(const NtgTransformParam & param, _model.params) { if( ! params.contains(param.name)) { if( param.isOptional) { if( ! param.defaultValue.isEmpty()) params[param.name] = param.defaultValue; } else { QString err("Missing mandatory param \"%1\" for transform \"%2\"!"); _setError(Ntg::InvalidParamsError, err.arg(param.name).arg(_model.name)); return 0; } } } foreach(const QString & param, params.keys()) { if( ! _model.params.contains(param)) { QString err("Unknown param \"%1\" for transform \"%2\"!"); _setError(Ntg::InvalidParamsError, err.arg(param).arg(_model.name)); return 0; } } _inputEntity = input; _exec(input, params); return true; }
int RegExpObject::search(Stringp subject) { int matchIndex, matchLen; UsesUTF8String utf8Subject(subject); if (!_exec(subject, utf8Subject, 0, matchIndex, matchLen)) { matchIndex = -1; } else { matchIndex = Utf8ToUtf16Index(subject, utf8Subject, matchIndex); } return matchIndex; }
void ServicesDb::deleteMap(long mapId) { _dropTable(_getRelationMembersTableName(mapId)); _dropTable(_getRelationsTableName(mapId)); _dropTable(_getWayNodesTableName(mapId)); _dropTable(_getWaysTableName(mapId)); _dropTable(_getNodesTableName(mapId)); _dropTable(_getChangesetsTableName(mapId)); _execNoPrepare("DROP SEQUENCE IF EXISTS " + _getNodeSequenceName(mapId) + " CASCADE"); _execNoPrepare("DROP SEQUENCE IF EXISTS " + _getWaySequenceName(mapId) + " CASCADE"); _execNoPrepare("DROP SEQUENCE IF EXISTS " + _getRelationSequenceName(mapId) + " CASCADE"); _exec("DELETE FROM maps WHERE id=:id", (qlonglong)mapId); }
int HLR2::_login(char const* msisdn) { //-- initialize http client... _hc.init(); std::string headers; std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soapenv:Body>\n" " <LGI>\n" " <OPNAME>" + _username + "</OPNAME>\n" " <PWD>" + _password + "</PWD>\n" " </LGI>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; //-- initialize parameters... _location.clear(); _msisdn = msisdn; _imsi = ""; if (0 > _exec(_url.c_str(), req.c_str(), _timeout, headers)) { return -1; } //-- parse headers char buf[512]; snprintf(buf, sizeof(buf), "%s", headers.c_str()); char* pbuf = strstr(buf, "Location"); if (pbuf && strchr(pbuf, ':')) { char* token; token = strtok_r(NULL, ":\r\n", &pbuf); token = strtok_r(NULL, "\r\n", &pbuf); if (token) { char loc[256]; snprintf(loc, sizeof(loc), "%s", token); str_trim(loc); _location = loc; } } return 0; }
int main(void){ char *buffer; char *argv[10]; int argc = 0; for(;;){ printf("\ey$ \ew"); buffer = getline(); argc = parse(buffer,argv,10); if(argc == 0) continue; if(OK != _exec(argv[0],argc,argv)) printf("%s : No usch file or directory\n",argv[0]); else run(MM_PID,15); } run(MM_PID,CLOSE); return 0; }
int HLR2::_deactivateCallForwarding4() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:era=\"http://www.huawei.com/HLR9820/ERA_CFNRY\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <era:ERA_CFNRY>\n" " <era:ISDN>" + _msisdn + "</era:ISDN>\n" " </era:ERA_CFNRY>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_activateOutgoingCallBarring3() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:act=\"http://www.huawei.com/HLR9820/ACT_BORO\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <act:ACT_BORO>\n" " <act:IMSI>" + _imsi + "</act:IMSI>\n" " <act:BSG>BS3X</act:BSG>\n" " </act:ACT_BORO>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_activateMultipartyConferenceCall2() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_BARPWD\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_BARPWD>\n" " <mod:ISDN>" + _msisdn + "</mod:ISDN>\n" " <mod:PWD>1234</mod:PWD>\n" " </mod:MOD_BARPWD>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_deactivateIncomingCallBarring2() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:dea=\"http://www.huawei.com/HLR9820/DEA_BICROM\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <dea:DEA_BICROM>\n" " <dea:IMSI>" + _imsi + "</dea:IMSI>\n" " <dea:BSG>BS3X</dea:BSG>\n" " </dea:DEA_BICROM>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_disableRingBackTone() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_NRBT\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_NRBT>\n" " <mod:ISDN>" + _msisdn + "</mod:ISDN>\n" " <mod:PROV>FALSE</mod:PROV>\n" " </mod:MOD_NRBT>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_disableOutgoingVoice1() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_RSZI\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_RSZI>\n" " <mod:IMSI>" + _imsi + "</mod:IMSI>\n" " <mod:RROPTION>ONLY_HPLMN</mod:RROPTION>\n" " </mod:MOD_RSZI>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_enableRoamingData2() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_DIAMRRS\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_DIAMRRS>\n" " <mod:IMSI>" + _imsi + "</mod:IMSI>\n" " <mod:PROV>FALSE</mod:PROV>\n" " </mod:MOD_DIAMRRS>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
QString ServicesDb::_execToString(QString sql, QVariant v1, QVariant v2, QVariant v3) { QSqlQuery q = _exec(sql, v1, v2, v3); QStringList l; while (q.next()) { QStringList row; for (int i = 0; i < q.record().count(); ++i) { row.append(q.value(i).toString()); } l.append(row.join(";")); } q.finish(); return l.join("\n"); }
int HLR2::_enableIncomingVoice() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_TCSI\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_TCSI>\n" " <mod:ISDN>" + _msisdn + "</mod:ISDN>\n" " <mod:PROV>TRUE</mod:PROV>\n" " <mod:TPLID>110</mod:TPLID>\n" " </mod:MOD_TCSI>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_enableOutgoingVoice2() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_VSRR\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_VSRR>\n" " <mod:IMSI>" + _imsi + "</mod:IMSI>\n" " <mod:PROV>TRUE</mod:PROV>\n" " <mod:TPLTYPE>VLR</mod:TPLTYPE>\n" " <mod:TPLID>4</mod:TPLID>\n" " </mod:MOD_VSRR>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
static int __delete_with_field(const char *tbl_name, const char *f_name, const char *val, int equal) { char tmp_val[BUF_MAX_LEN]; char *_sqlbuf; int rc; if (equal) { _sqlbuf = sqlite3_mprintf("DELETE FROM %s WHERE %s = '%s';", tbl_name, f_name, val); } else { snprintf(tmp_val, BUF_MAX_LEN, "%%%s%%", val); _sqlbuf = sqlite3_mprintf("DELETE FROM %s WHERE %s like '%s';", tbl_name, f_name, tmp_val); } rc = _exec(mida_db, _sqlbuf); sqlite3_free(_sqlbuf); return rc; }
int HLR2::_getIMSI() { std::string req; //-- clear imsi buffer _imsi.clear(); //-- Query IMSI given MSISDN req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:lst=\"http://www.huawei.com/HLR9820/LST_IMSI\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <lst:LST_IMSI>\n" " <lst:ISDN>" + _msisdn + "</lst:ISDN>\n" " </lst:LST_IMSI>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; pugi::xml_document doc; if (0 > _exec(_location.c_str(), req.c_str(), _timeout, doc)) { return -1; } pugi::xml_node result = doc .child("SOAP-ENV:Envelope") .child("SOAP-ENV:Body") .child("LST_IMSIResponse") .child("Result"); pugi::xml_node resultData = result.child("ResultData"); for (pugi::xml_node group = resultData.child("Group"); group; group = group.next_sibling("Group")) { if (pugi::xml_node imsi = group.child("IMSI")) { _imsi = imsi.child_value(); } } return 0; }
int HLR2::_enableOutgoingVoice3() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" " xmlns:mod=\"http://www.huawei.com/HLR9820/MOD_LCK\">\n" "<soapenv:Header/>\n" "<soapenv:Body>\n" " <mod:MOD_LCK>\n" " <mod:IMSI>" + _imsi + "</mod:IMSI>\n" " <mod:IC>FALSE</mod:IC>\n" " <mod:OC>FALSE</mod:OC>\n" " <mod:GPRSLOCK>FALSE</mod:GPRSLOCK>\n" " <mod:CSUPLLCK>FALSE</mod:CSUPLLCK>\n" " <mod:PSUPLLCK>FALSE</mod:PSUPLLCK>\n" " <mod:EPSLOCK>FALSE</mod:EPSLOCK>\n" " </mod:MOD_LCK>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; return _exec(_location.c_str(), req.c_str(), _timeout); }
int HLR2::_logout() { std::string req; req = "<?xml version=\"1.0\" ?>\n" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soapenv:Body>\n" " <LGO></LGO>\n" "</soapenv:Body>\n" "</soapenv:Envelope>\n"; int status = _exec(_location.c_str(), req.c_str(), _timeout); //-- clear parameters... _location.clear(); _msisdn.clear(); _imsi.clear(); //-- deinitialize http client... _hc.deinit(); return status; }