コード例 #1
0
ファイル: testsocket.cpp プロジェクト: rclakmal/HPCC-Platform
void SplitIpPort(StringAttr & ip, unsigned & port, const char * address)
{
    const char * colon = strchr(address, ':');
    if (colon)
    {
        ip.set(address,colon-address);
        port = atoi(colon+1);
    }
    else
        ip.set(address);
}
コード例 #2
0
IHqlRemoteScope * XmlEclRepository::resolveScope(IProperties *props, const char * modname, bool deleteIfExists, bool createIfMissing)
{
    Owned<IHqlRemoteScope> parentScope = LINK(rootScope);
    
    const char * item = modname;
    const char * dot;
    do
    {
        dot = strchr(item, '.');
        _ATOM moduleName;
        StringAttr fullName;
        if (dot)
        {
            moduleName = createIdentifierAtom(item, dot-item);
            fullName.set(modname, dot - modname);
            item = dot + 1;
        }
        else
        {
            moduleName = createIdentifierAtom(item);
            fullName.set(modname);
        }

        //nested module already exist in parent scope?
        Owned<IHqlRemoteScope> rScope = parentScope->lookupRemoteModule(moduleName);

        if (!rScope && !createIfMissing)
            return NULL;

        if (rScope && deleteIfExists && !dot)
        {
            rScope->noteTextModified();
            if (rScope->isEmpty())
                parentScope->removeNestedScope(moduleName);
            return NULL;
        }

        if (!rScope)
        {
            rScope.setown(createRemoteScope(moduleName, fullName, this, dot ? NULL : props, NULL, true));

            int flags = props->getPropInt("@flags", 0);
            parentScope->addNestedScope(rScope->queryScope(), flags);
        }
        else
            rScope->invalidateParsed();

        parentScope.set(rScope);
    } while (dot);
    if (parentScope)
        parentScope->noteTextModified();
    return parentScope.getLink();
}
コード例 #3
0
ファイル: hrpcutil.cpp プロジェクト: LlsDimple/HPCC-Platform
void SplitIpPort(StringAttr & ip, unsigned & port, const char * address)
{
  const char * colon = strchr(address, ':');
  if (colon)
  {
    ip.set(address,colon-address);
    if (strcmp(ip, ".")==0)
        ip.set(GetCachedHostName());
    port = atoi(colon+1);
  }
  else
    ip.set(address);
}
コード例 #4
0
 CMethodInfo(const char * label, const char * req, const char * resp) //, const char *sectag, const char *optag,const char* minver=NULL, const char* maxver=NULL)
 {
     m_label.set(label);
     m_requestLabel.set(req);
     m_responseLabel.set(resp);
     /*
     if (sectag)
         m_securityTag.append(sectag);
     if (optag)
         m_optionalTag.append(optag);
     m_minVer = (minver)?atof(minver):-1;
     m_maxVer = (maxver)?atof(maxver):-1;
     */
 };
コード例 #5
0
ファイル: deffield.cpp プロジェクト: aa0/HPCC-Platform
static void addElementToPTree(IPropertyTree * root, IDefRecordElement * elem)
{
    byte kind = elem ? elem->getKind() : DEKnone;
    Owned<IPTree> branch = createPTree();
    StringAttr branchName;
    switch (kind)
    {
    case DEKnone:
        branchName.set("None");
        assertex(elem->numChildren() == 0);
        break;
    case DEKrecord:
        {
            branchName.set("Record");
            branch->setPropInt("@maxSize", elem->getMaxSize());
            unsigned numChildren = elem->numChildren();
            for (unsigned i=0; i < numChildren; i++)
                addElementToPTree(branch, elem->queryChild(i));
            break;
        }
    case DEKifblock:
        {
            branchName.set("IfBlock");
            StringBuffer value;
            elem->queryCompareValue()->getStringValue(value);
            branch->setProp("@compareValue", value.str());
            assertex(elem->numChildren() == 2);
            addElementToPTree(branch, elem->queryChild(0));
            addElementToPTree(branch, elem->queryChild(0));
            break;
        }
    case DEKfield:
        {
            branchName.set("Field");
            branch->setProp("@name", elem->queryName()->str());
            branch->setPropInt("@maxSize", elem->getMaxSize());
            StringBuffer type;
            elem->queryType()->getDescriptiveType(type);
            branch->setProp("@type", type.str());
            assertex(elem->numChildren() <= 1);
            if(elem->numChildren())
                addElementToPTree(branch, elem->queryChild(0));
            break;
        }
    default:
        throwUnexpected();
    }
    root->addPropTree(branchName.get(), branch.getClear());
}
コード例 #6
0
    bool finalizeOptions(IProperties *globals)
    {
        if (optInput.length())
        {
            const char *in = optInput.get();
            while (*in && isspace(*in)) in++;
            if (*in!='<')
            {
                StringBuffer content;
                content.loadFile(in);
                optInput.set(content.str());
            }
        }

        if (optESDLDefID.isEmpty())
            throw MakeStringException( 0, "ESDL definition ID must be provided!" );

        if (optESDLService.isEmpty())
            throw MakeStringException( 0, "ESDL service definition name must be provided!" );

        if(optTargetESPProcName.isEmpty())
            throw MakeStringException( 0, "Name of Target ESP process must be provided!" );

        if (optPortOrName.isEmpty())
            throw MakeStringException( 0, "Either the target ESP service port of name must be provided!" );
        else
        {
            const char * portorname =  optPortOrName.get();
            isdigit(*portorname) ? optTargetPort.set(portorname) : optService.set(portorname);
        }

        return EsdlPublishCmdCommon::finalizeOptions(globals);
    }
コード例 #7
0
//---------------------------------------------------------------------------
//  getAccountInfo
//---------------------------------------------------------------------------
void getAccountInfo(const char* computer, StringAttr& user, StringAttr& pwd, IConstEnvironment* pConstEnv) 
{
  if (!pConstEnv)
    throw MakeStringException(-1, "No environment is available!");

  Owned<IConstMachineInfo> machine = pConstEnv->getMachine(computer);
  if (!machine)
  {
    StringBuffer sComputer(computer);
    StringBuffer sExtra;
    if (sExtra.length() == 0)
      machine.setown( pConstEnv->getMachineByAddress(computer) );

    if (!machine)
      throw MakeStringException(-1, "The computer '%s' is undefined!", computer);
  }

  Owned<IConstDomainInfo> domain = machine->getDomain();
  if (!domain)
    throw MakeStringException(-1, "The computer '%s' does not have any domain information!", computer);

  StringBuffer x;
  domain->getName(StringBufferAdaptor(x));
  if (x.length()) 
    x.append(PATHSEPCHAR);
  domain->getAccountInfo(StringBufferAdaptor(x), StringAttrAdaptor(pwd));
  user.set(x.str());
}
コード例 #8
0
    void processOption(const char *option, const char *value, StringBuffer &eclccCmd, StringBuffer &eclccProgName, IPipeProcess &pipe, bool isLocal)
    {
        if (memicmp(option, "eclcc-", 6) == 0 || *option=='-')
        {
            //Allow eclcc-xx-<n> so that multiple values can be passed through for the same named debug symbol
            const char * start = option + (*option=='-' ? 1 : 6);
            const char * dash = strchr(start, '-');     // position of second dash, if present
            StringAttr optName;
            if (dash)
                optName.set(start, dash-start);
            else
                optName.set(start);

            if (stricmp(optName, "hook") == 0)
            {
                if (isLocal)
                    throw MakeStringException(0, "eclcc-hook option can not be set per-workunit");  // for security reasons
                eclccProgName.set(value);
            }
            else if (stricmp(optName, "compileOption") == 0)
                eclccCmd.appendf(" -Wc,%s", value);
            else if (stricmp(optName, "includeLibraryPath") == 0)
                eclccCmd.appendf(" -I%s", value);
            else if (stricmp(optName, "libraryPath") == 0)
                eclccCmd.appendf(" -L%s", value);
            else if (stricmp(start, "-allow")==0)
            {
                if (isLocal)
                    throw MakeStringException(0, "eclcc-allow option can not be set per-workunit");  // for security reasons
                eclccCmd.appendf(" -%s=%s", start, value);
            }
            else
                eclccCmd.appendf(" -%s=%s", start, value);
        }
        else if (strchr(option, '-'))
        {
            StringBuffer envVar;
            if (isLocal)
                envVar.append("WU_");
            envVar.append(option);
            envVar.toUpperCase();
            envVar.replace('-','_');
            pipe.setenv(envVar, value);
        }
        else
            eclccCmd.appendf(" -f%s=%s", option, value);
    }
コード例 #9
0
    bool parseCommandLineOptions(ArgvIterator &iter)
    {
        if (iter.done())
        {
            usage();
            return false;
        }

        //First 4 parameter's order is fixed.
        //TargetESPProcessName
        //TargetESPBindingPort | TargetESPServiceName
        //ESDLDefinitionId
        //ESDLServiceName
        for (int cur = 0; cur < 4 && !iter.done(); cur++)
        {
           const char *arg = iter.query();
           if (*arg != '-')
           {
               switch (cur)
               {
                case 0:
                    optTargetESPProcName.set(arg);
                    break;
                case 1:
                    optPortOrName.set(arg);
                    break;
                case 2:
                    optESDLDefID.set(arg);
                    break;
                case 3:
                    optESDLService.set(arg);
                    break;
                default:
                    fprintf(stderr, "\nUnrecognized positional argument detected : %s\n", arg);
                    usage();
                    return false;
               }
           }
           else
           {
               fprintf(stderr, "\nOption detected before required arguments: %s\n", arg);
               usage();
               return false;
           }

           iter.next();
        }

        for (; !iter.done(); iter.next())
        {
            if (parseCommandLineOption(iter))
                continue;

            if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
                return false;
        }

        return true;
    }
コード例 #10
0
 void init()
 {
     StringBuffer xpath("Software/ThorCluster[@name=\"");
     xpath.append(clusterName).append("\"]");
     Owned<IRemoteConnection> conn = querySDS().connect("/Environment", myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT);
     environment.setown(createPTreeFromIPT(conn->queryRoot()));
     options = environment->queryPropTree(xpath.str());
     if (!options)
         throwUnexpected();
     groupName.set(options->queryProp("@nodeGroup"));
     if (groupName.isEmpty())
         groupName.set(options->queryProp("@name"));
     VStringBuffer spareS("%s_spares", groupName.get());
     spareGroupName.set(spareS);
     group.setown(queryNamedGroupStore().lookup(groupName));
     spareGroup.setown(queryNamedGroupStore().lookup(spareGroupName));
 }
コード例 #11
0
ファイル: thkeypatch.cpp プロジェクト: hhy5277/HPCC-Platform
    virtual void init()
    {
        CMasterActivity::init();
        helper = (IHThorKeyPatchArg *)queryHelper();
        OwnedRoxieString originalHelperName(helper->getOriginalName());
        OwnedRoxieString patchHelperName(helper->getPatchName());
        OwnedRoxieString outputHelperName(helper->getOutputName());
        StringBuffer expandedFileName;
        queryThorFileManager().addScope(container.queryJob(), originalHelperName, expandedFileName, false);
        originalName.set(expandedFileName);
        queryThorFileManager().addScope(container.queryJob(), patchHelperName, expandedFileName.clear(), false);
        patchName.set(expandedFileName);
        queryThorFileManager().addScope(container.queryJob(), outputHelperName, expandedFileName.clear(), false);
        outputName.set(expandedFileName);

        originalIndexFile.setown(queryThorFileManager().lookup(container.queryJob(), originalHelperName));
        patchFile.setown(queryThorFileManager().lookup(container.queryJob(), patchHelperName));
        
        if (originalIndexFile->numParts() != patchFile->numParts())
            throw MakeActivityException(this, TE_KeyPatchIndexSizeMismatch, "Index %s and patch %s differ in width", originalName.get(), patchName.get());
        if (originalIndexFile->querySuperFile() || patchFile->querySuperFile())
            throw MakeActivityException(this, 0, "Patching super files not supported");
        
        addReadFile(originalIndexFile);
        addReadFile(patchFile);

        width = originalIndexFile->numParts();

        originalDesc.setown(originalIndexFile->getFileDescriptor());
        patchDesc.setown(patchFile->getFileDescriptor());

        Owned<IPartDescriptor> tlkDesc = originalDesc->getPart(originalDesc->numParts()-1);
        const char *kind = tlkDesc->queryProperties().queryProp("@kind");
        local = NULL == kind || 0 != stricmp("topLevelKey", kind);

        if (!local && width > 1)
            width--; // 1 part == No n distributed / Monolithic key
        if (width > container.queryJob().querySlaves())
            throw MakeActivityException(this, 0, "Unsupported: keypatch(%s, %s) - Cannot patch a key that's wider(%d) than the target cluster size(%d)", originalIndexFile->queryLogicalName(), patchFile->queryLogicalName(), width, container.queryJob().querySlaves());

        IArrayOf<IGroup> groups;
        fillClusterArray(container.queryJob(), outputName, clusters, groups);
        newIndexDesc.setown(queryThorFileManager().create(container.queryJob(), outputName, clusters, groups, 0 != (KDPoverwrite & helper->getFlags()), 0, !local, width));
        if (!local)
            newIndexDesc->queryPart(newIndexDesc->numParts()-1)->queryProperties().setProp("@kind", "topLevelKey");
    }
コード例 #12
0
ファイル: rmtfile.cpp プロジェクト: jastephe/HPCC-Platform
 CDaliServixFilter(IPropertyTree &filter)
 {
     const char *subnet = filter.queryProp("@subnet");
     const char *mask = filter.queryProp("@mask");
     if (!ipSubNet.set(subnet, mask))
         throw MakeStringException(0, "Invalid sub net definition: %s, %s", subnet, mask);
     dir.set(filter.queryProp("@directory"));
     trace = filter.getPropBool("@trace");
 }
コード例 #13
0
bool extractEclCmdOption(StringAttr & option, IProperties * globals, const char * envName, const char * propertyName, const char * defaultPrefix, const char * defaultSuffix)
{
    if (option)
        return true;
    StringBuffer temp;
    bool ret = extractEclCmdOption(temp, globals, envName, propertyName, defaultPrefix, defaultSuffix);
    option.set(temp.str());
    return ret;
}
コード例 #14
0
ファイル: dafuse.cpp プロジェクト: AlexLuya/HPCC-Platform
 int init(const char *caller,const char *_path, bool allscopes,bool allfiles)
 {
     if (_path==NULL)
         path.set("");
     else
         path.set(_path);
     err = 0;
     try {
         if (!queryDistributedFileDirectory().loadScopeContents(_path,allscopes?&scopes:NULL,allfiles?&supers:NULL,allfiles?&files:NULL,true))
             err = -ENOENT;
         else
             if (allfiles)
                 donefiles = true;
     }
     catch (IException *e) {
         EXCLOG(e,caller);
         err = -EFAULT;
     }   
     return err;
 }
コード例 #15
0
 void setPMID(const char *_target, const char *name, bool globalScope)
 {
     if (!name || !*name)
         throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "PackageMap name parameter required");
     if (!globalScope)
     {
         target.set(_target);
         if (target.isEmpty())
             throw MakeStringExceptionDirect(PKG_MISSING_PARAM, "Target cluster parameter required");
         ensureClusterInfo();
         pmid.append(target).append("::");
     }
     pmid.append(name);
     pmid.toLowerCase();
 }
コード例 #16
0
        bool parseCommandLineOptions(ArgvIterator &iter)
           {
               if (iter.done())
               {
                   usage();
                   return false;
               }

               //First parameter is fixed.
               for (int cur = 0; cur < 1 && !iter.done(); cur++)
               {
                  const char *arg = iter.query();
                  if (*arg != '-')
                  {
                      switch (cur)
                      {
                       case 0:
                           optId.set(arg);
                           break;
                       default:
                           fprintf(stderr, "\nUnrecognized positional argument detected : %s\n", arg);
                           usage();
                           return false;
                      }
                  }
                  else
                  {
                      fprintf(stderr, "\noption detected before required arguments: %s\n", arg);
                      usage();
                      return false;
                  }

                  iter.next();
               }

               for (; !iter.done(); iter.next())
               {
                   if (parseCommandLineOption(iter))
                       continue;

                   if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
                       return false;
               }

               return true;
           }
コード例 #17
0
    bool parseCommandLineOptions(ArgvIterator &iter)
    {
        if (iter.done())
        {
            usage();
            return false;
        }

        for (int cur = 0; cur < 2 && !iter.done(); cur++)
        {
           const char *arg = iter.query();
           if (*arg != '-')
           {
               switch (cur)
               {
                case 0:
                    optTargetESPProcName.set(arg);
                    break;
                case 1:
                    optEspBinding.set(arg);
                    break;
               }
           }
           else
           {
               fprintf(stderr, "\nOption detected before required arguments: %s\n", arg);
               usage();
               return false;
           }

           iter.next();
        }

        for (; !iter.done(); iter.next())
        {
            if (parseCommandLineOption(iter))
                continue;

            if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
                return false;
        }

        return true;
    }
コード例 #18
0
int CLibXmlValidator::setXmlSource(const char* filename)
{
    if (!filename)
        return 0;

    try 
    {
        xml.loadFile(filename);
    }
    catch (IException* e)
    {
        DBGLOG(e);
        e->Release();
        return 0;
    }

    xmlFile.set(filename);
    return 1;
}
コード例 #19
0
    bool finalizeOptions(IProperties *globals)
    {
        if (optInput.length())
        {
            const char *in = optInput.get();
            while (*in && isspace(*in)) in++;
            if (*in!='<')
            {
                StringBuffer content;
                content.loadFile(in);
                optInput.set(content.str());
            }
        }

        if (optESDLDefID.isEmpty())
            throw MakeStringException( 0, "ESDL definition ID must be provided!" );

        if (optESDLService.isEmpty())
            throw MakeStringException( 0, "ESDL service definition name must be provided!" );

        if(optTargetESPProcName.isEmpty())
            throw MakeStringException( 0, "Name of Target ESP process must be provided!" );

        if (optPortOrName.isEmpty())
            throw MakeStringException( 0, "Either the target ESP service port of name must be provided!" );
        else
        {
            const char * portorname =  optPortOrName.get();
            isdigit(*portorname) ? optTargetPort.set(portorname) : optService.set(portorname);
        }

        if (optWSProcAddress.isEmpty())
            throw MakeStringException( 0, "Server address of ESDL process server must be provided" );

        if (optWSProcPort.isEmpty())
            throw MakeStringException( 0, "Port on which ESDL process is listening must be provided" );

        return true;
    }
コード例 #20
0
ファイル: thspill.cpp プロジェクト: RogerDev/HPCC-Platform
    virtual void init()
    {
        CMasterActivity::init();
        IHThorSpillArg *helper = (IHThorSpillArg *)queryHelper();
        IArrayOf<IGroup> groups;
        OwnedRoxieString helperFileName = helper->getFileName();
        StringBuffer expandedFileName;
        queryThorFileManager().addScope(container.queryJob(), helperFileName, expandedFileName, true);
        fileName.set(expandedFileName);

        fillClusterArray(container.queryJob(), fileName, clusters, groups);
        fileDesc.setown(queryThorFileManager().create(container.queryJob(), fileName, clusters, groups, true, TDWnoreplicate+TDXtemporary));
        IPropertyTree &props = fileDesc->queryProperties();
        bool blockCompressed=false;
        void *ekey;
        size32_t ekeylen;
        helper->getEncryptKey(ekeylen,ekey);
        if (ekeylen)
        {
            memset(ekey,0,ekeylen);
            free(ekey);
            props.setPropBool("@encrypted", true);      
            blockCompressed = true;
        }
        else if (0 != (helper->getFlags() & TDWnewcompress) || 0 != (helper->getFlags() & TDXcompress))
            blockCompressed = true;
        if (blockCompressed)
            props.setPropBool("@blockCompressed", true);        
        if (0 != (helper->getFlags() & TDXgrouped))
            fileDesc->queryProperties().setPropBool("@grouped", true);
        props.setProp("@kind", "flat");
        if (container.queryOwner().queryOwner() && (!container.queryOwner().isGlobal())) // I am in a child query
        { // do early, because this will be local act. and will not come back to master until end of owning graph.
            container.queryTempHandler()->registerFile(fileName, container.queryOwner().queryGraphId(), helper->getTempUsageCount(), TDXtemporary & helper->getFlags(), getDiskOutputKind(helper->getFlags()), &clusters);
            queryThorFileManager().publish(container.queryJob(), fileName, *fileDesc);
        }
    }
コード例 #21
0
ファイル: initldap.cpp プロジェクト: RogerDev/HPCC-Platform
//-----------------------------------------------------
//
//-----------------------------------------------------
bool initLDAP(IPropertyTree * ldapProps)
{
    StringAttr serverType( ldapProps->queryProp("@serverType") );
    if (!serverType.length())
    {
        fprintf(stderr, "\nERROR: serverType not set in LDAPServer component");
        return false;
    }

    StringBuffer hpccUser;
    StringBuffer hpccPwd;
    ldapProps->getProp("@systemUser", hpccUser);
    ldapProps->getProp("@systemPassword", hpccPwd);
    if (0==hpccUser.length() || 0==hpccPwd.length())
    {
        fprintf(stderr, "\nERROR: HPCC systemUser credentials not found in configuration");
        return false;
    }

    StringBuffer ldapAddress;
    ldapProps->getProp("@ldapAddress", ldapAddress);

    //Get LDAP admin creds from user
    char buff[100];
    fprintf(stdout, "\nEnter the '%s' LDAP Admin User name on '%s'...",serverType.get(),ldapAddress.str());
    do
    {
        char * line = fgets(buff, sizeof(buff), stdin);
        if (!line)
            return false;
    }
    while (buff[0] == (char)'\n');

    if (buff[strlen(buff)-1] == '\n')
        buff[strlen(buff)-1] = (char)NULL;
    StringAttr ldapUser(buff);

    fprintf(stdout, "Enter the LDAP Admin user '%s' password...",ldapUser.get());
    char * line = fgets(buff, sizeof(buff), stdin);
    if (!line)
        return false;

    if (buff[strlen(buff)-1] == '\n')
        buff[strlen(buff)-1] = (char)NULL;
    StringAttr ldapPwd(buff);
    if (0==ldapUser.length() || 0==ldapPwd.length())
    {
        fprintf(stderr, "\nERROR: Invalid LDAP Admin account credentials entered");
        return false;
    }

    fprintf(stdout, "\nReady to initialize HPCC LDAP Environment, using the following settings");
    fprintf(stdout, "\n\tLDAP Server     : %s", ldapAddress.str());
    fprintf(stdout, "\n\tLDAP Type       : %s", serverType.get());
    fprintf(stdout, "\n\tHPCC Admin User : %s", hpccUser.str());
    fprintf(stdout, "\nProceed?  y/n ");
    for (;;)
    {
        int c = getchar();
        if (c == 'y' || c == 'Y')
            break;
        else if (c == 'n' || c == 'N')
            return true;
    }

    if (stricmp(serverType.get(),"ActiveDirectory"))
        ldapProps->setProp("@systemBasedn", "");

    //Replace system user with LDAP Admin credentials
    ldapProps->setProp("@systemUser", ldapUser);
    ldapProps->setProp("@systemCommonName", ldapUser);
    StringBuffer sb;
    encrypt(sb,ldapPwd);
    ldapProps->setProp("@systemPassword", sb.str());

    //Create security manager. This creates the required OUs
    Owned<ISecManager> secMgr;
    try
    {
        secMgr.setown(newLdapSecManager("initldap", *LINK(ldapProps)));
    }
    catch(IException *e)
    {
        StringBuffer buff;
        e->errorMessage(buff);
        e->Release();
        fprintf(stderr, "\nERROR: Unable to create security manager : %s", buff.str());
        return false;
    }

    //Create HPCC Admin user
    Owned<ISecUser> user = secMgr->createUser(hpccUser.str());
    StringBuffer pwd;
    decrypt(pwd, hpccPwd.str());
    user->credentials().setPassword(pwd.str());
    try { secMgr->addUser(*user.get()); }
    catch(...) {}//user may already exist, so just move on

    //Add HPCC admin user to Administrators group
    CLdapSecManager* ldapSecMgr = dynamic_cast<CLdapSecManager*>(secMgr.get());
    if (!ldapSecMgr)
    {
        fprintf(stderr, "\nERROR: Unable to access CLdapSecManager object");
        return false;
    }
    StringAttr adminGroup;
    bool isActiveDir = true;
    if (0 == stricmp(serverType.get(),"ActiveDirectory"))
        adminGroup.set("Administrators");
    else
        adminGroup.set("Directory Administrators");
    try { ldapSecMgr->changeUserGroup("add", hpccUser.str(), adminGroup); }
    catch(...) {}//user may already be in group so just move on

    fprintf(stdout, "\n\nLDAP Initialization successful\n");
    return true;
}
コード例 #22
0
ファイル: jcomp.cpp プロジェクト: RogerDev/HPCC-Platform
static void doSetCompilerPath(const char * path, const char * includes, const char * libs, const char * tmpdir, unsigned targetCompiler, bool verbose)
{
    if (!includes)
        includes = INCLUDEPATH[targetCompiler];
    if (!libs)
        libs = LIB_DIR[targetCompiler];
    if (verbose)
    {
        PrintLog("Include directory set to %s", includes);
        PrintLog("Library directory set to %s", libs);
    }
    compilerRoot.set(path ? path : targetCompiler==GccCppCompiler ? "/usr" : ".\\CL");
    stdIncludes.set(includes);
    stdLibs.clear();
    for (;;)
    {
        StringBuffer thislib;
        while (*libs && *libs != ENVSEPCHAR)
            thislib.append(*libs++);
        if (thislib.length())
        {
            stdLibs.append(" ").append(USE_LIBPATH_FLAG[targetCompiler]).append(thislib).append(USE_LIBPATH_TAIL[targetCompiler]);
            if (USE_LIBRPATH_FLAG[targetCompiler])
                stdLibs.append(" ").append(USE_LIBRPATH_FLAG[targetCompiler]).append(thislib);
        }
        if (!*libs)
            break;
        libs++;
    }
    StringBuffer fname;
    if (path)
    {
        const char *finger = CC_NAME[targetCompiler];
        while (*finger)
        {
            if (*finger == '#')
                fname.append(path);
            else
                fname.append(*finger);
            finger++;
        }

#if defined(__linux__)
        StringBuffer clbin_dir;
        const char* dir_end = strrchr(fname, '/');
        if(dir_end == NULL)
            clbin_dir.append(".");
        else
            clbin_dir.append((dir_end - fname.str()) + 1, fname.str());
        
        StringBuffer pathenv(clbin_dir.str());
        const char* oldpath = getenv("PATH");
        if(oldpath != NULL && *oldpath != '\0')
        pathenv.append(":").append(oldpath);
        setenv("PATH", pathenv.str(), 1);
#endif
    }
    else
    {
        fname.append(compilerRoot).append(CC_NAME[targetCompiler]);
        fname.replaceString("#",NULL);
    }
    if (verbose)
        PrintLog("Compiler path set to %s", fname.str());

    dequote(fname);
#ifdef _WIN32
    if (_access(fname.str(), 4))
    {
#else
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
    struct stat filestatus;
    int r = stat(fname.str(), &filestatus);
    if (    (r != 0)
        ||  (!S_ISREG(filestatus.st_mode))
        ||  ((filestatus.st_mode&(S_IXOTH|S_IXGRP|S_IXUSR))==0))
    {
        if (r == -1) errno = ENOENT;
#endif
#endif
        if (verbose)
            PrintLog("SetCompilerPath - no compiler found");
        throw makeOsExceptionV(GetLastError(), "setCompilerPath could not locate compiler %s", fname.str());
    }

    if(tmpdir && *tmpdir)
    {
        //MORE: this should be done for the child process instead of the parent but invoke does not let me do it
#if defined(__linux__)
        setenv("TMPDIR", tmpdir, 1);
#endif

#ifdef _WIN32
        StringBuffer tmpbuf;
        tmpbuf.append("TMP=").append(tmpdir);
        _putenv(tmpbuf.str());
#endif
    }
}

//===========================================================================

class CCompilerThreadParam : public CInterface
{
public:
    CCompilerThreadParam(const StringBuffer & _cmdline, Semaphore & _finishedCompiling, const StringBuffer & _logfile) : cmdline(_cmdline), logfile(_logfile), finishedCompiling(_finishedCompiling) {};

    StringBuffer        cmdline;
    StringBuffer        logfile;
    Semaphore       &   finishedCompiling;
};

//===========================================================================

static void setDirectoryPrefix(StringAttr & target, const char * source)
{
    if (source && *source)
    {
        StringBuffer temp;
        target.set(addDirectoryPrefix(temp, source));
    }
}

CppCompiler::CppCompiler(const char * _coreName, const char * _sourceDir, const char * _targetDir, unsigned _targetCompiler, bool _verbose)
{
    coreName.set(_coreName);
    targetCompiler = _targetCompiler;
    createDLL = true;
#ifdef _DEBUG
    setDebug(true);
    setDebugLibrary(true);
#else
    setDebug(false);
    setDebugLibrary(false);
#endif
    
    setDirectoryPrefix(sourceDir, _sourceDir);
    setDirectoryPrefix(targetDir, _targetDir);
    maxCompileThreads = 1;
    onlyCompile = false;
    verbose = _verbose;
    saveTemps = false;
    abortChecker = NULL;
    precompileHeader = false;
    linkFailed = false;
}
コード例 #23
0
int CEclAgentExecutionServer::run()
{
    Owned<IFile> sentinelFile = createSentinelTarget();
    removeSentinelFile(sentinelFile);
    try
    {
        Owned<IGroup> serverGroup = createIGroup(daliServers, DALI_SERVER_PORT);
        initClientProcess(serverGroup, DCR_EclServer);
        getAgentQueueNames(queueNames, agentName);
        queue.setown(createJobQueue(queueNames.str()));
        queue->connect();
    }
    catch (IException *e) 
    {
        EXCLOG(e, "Server queue create/connect: ");
        e->Release();
        return -1;
    }
    catch(...)
    {
        ERRLOG("Terminating unexpectedly");
    }

    writeSentinelFile(sentinelFile);

    try 
    {
        while (started)
        {
            PROGLOG("AgentExec: Waiting on queue(s) '%s'", queueNames.str());
            Owned<IJobQueueItem> item = queue->dequeue(WAIT_FOREVER);
            if (item.get())
            {
                rebuildLogfileName();//rebuild in case date rollover
                StringAttr wuid;
                wuid.set(item->queryWUID());
                PROGLOG("AgentExec: Dequeued workunit request '%s'", wuid.get());
                try
                {
                    executeWorkunit(wuid);
                }
                catch(IException *e)
                {
                    EXCLOG(e, "CEclAgentExecutionServer::run: ");
                }
                catch(...)
                {
                    ERRLOG("Unexpected exception in CEclAgentExecutionServer::run caught");
                }
            }
            else
            {
                ERRLOG("Unexpected dequeue of bogus job queue item, exiting agentexec");
                removeSentinelFile(sentinelFile);//no reason to restart
                assert(!started);
                break;
            }
        }
    }

    catch (IException *e) 
    {
        EXCLOG(e, "Server Exception: ");
        e->Release();
        PROGLOG("Exiting");
    }

    try 
    {
        queue->disconnect();
    }
    catch (IException *e) 
    {
        EXCLOG(e, "Server queue disconnect: ");
        e->Release();
    }
    PROGLOG("Exiting agentexec\n");
    return 1;
}
コード例 #24
0
 CMethodInfo(CMethodInfo &src)
 {
     m_label.set(src.m_label);
     m_requestLabel.set(src.m_requestLabel);
     m_responseLabel.set(src.m_responseLabel);
 };
コード例 #25
0
 virtual void getAssert(StringAttr &_file, unsigned &_line, unsigned &_column) const { _file.set(file); _line = line; _column = column; }
コード例 #26
0
ファイル: soapenc.cpp プロジェクト: AlexLuya/HPCC-Platform
void SoapEnc::deserialize(const char* str, StringAttr& val)
{
    val.set(str);
}
コード例 #27
0
ファイル: ftbase.cpp プロジェクト: aa0/HPCC-Platform
void setFtSlaveLogDir(const char *dir)
{
    PROGLOG("ftslave log dir set to %s",dir);
    ftslavelogdir.set(dir);
}
コード例 #28
0
 void setProcess(const char *name)
 {
     process.set(name);
     buildPkgSetId(pkgSetId, process);
 }
コード例 #29
0
bool WsEclWuInfo::getWsResource(const char *name, StringBuffer &out)
{
    if (strieq(name, "SOAP"))
    {
        out.appendf("<message name=\"%s\">", queryname.sget());
        IConstWUResultIterator &vars = ensureWorkUnit()->getVariables();
        Owned<IResultSetFactory> resultSetFactory(getResultSetFactory(username, password));
        ForEach(vars)
        {
            IConstWUResult &var = vars.query();
            SCMStringBuffer varname;
            var.getResultName(varname);
            int seq = var.getResultSequence();

            WUResultFormat fmt = var.getResultFormat();

            SCMStringBuffer eclschema;
            var.getResultEclSchema(eclschema);

            SCMStringBuffer s;
            Owned<IResultSetMetaData> meta = resultSetFactory->createResultSetMeta(&var);

            if (!var.isResultScalar())
            {
                meta->getXmlSchema(s, false);
                out.appendf("<part name=\"%s\" type=\"tns:XmlDataSet\" />", varname.str());
            }
            else
            {
                meta->getColumnEclType(s, 0);
                DisplayType dt = meta->getColumnDisplayType(0);
                StringAttr ptype;
                switch (dt)
                {
                case TypeBoolean:
                    ptype.set("xsd:boolean");
                    break;
                case TypeInteger:
                    ptype.set("xsd:integer");
                    break;
                case TypeUnsignedInteger:
                    ptype.set("xsd:integer");
                    break;
                case TypeReal:
                    ptype.set("xsd:real");
                    break;
                case TypeSet:
                    ptype.set("tns:EspStringArray");
                    break;
                case TypeDataset:
                case TypeData:
                    ptype.set("tns:XmlDataSet");
                    break;
                case TypeUnicode:
                case TypeString:
                    ptype.set("xsd:string");
                    break;
                case TypeUnknown:
                case TypeBeginIfBlock:
                case TypeEndIfBlock:
                case TypeBeginRecord:
                default:
                    ptype.set("xsd:string");
                    break;
                }
                out.appendf("<part name=\"%s\" type=\"%s\" />", varname.str(), ptype.sget());
            }
        }
        out.append("</message>");
    }
コード例 #30
0
ファイル: soapparam.hpp プロジェクト: AsherBond/HPCC-Platform
inline bool esp_convert(const char* sv, StringAttr& value){value.set(sv); return (!sv);}