예제 #1
0
/*
 * Place the block and potentially split the block
 * Return: Nothing
 */
static void place(void *block, unsigned int awords) {
    REQUIRES(awords >= 2 && awords % 2 == 0);
    REQUIRES(block != NULL);
    REQUIRES(in_heap(block));
    REQUIRES(in_list(block));

    unsigned int cwords = block_size(block); //the size of the given freeblock
    block_delete(block);      // delete block from the seg list
    
    ENSURES(!in_list(block));

    if ((cwords - awords) >= 4) {
        set_size(block, awords);
        block_mark(block, ALLOCATED);
        block = block_next(block);
        set_size(block, cwords - awords - 2);
        block_mark(block, FREE);
        block_insert(block);

        ENSURES(in_list(block));
    } else {
        set_size(block, cwords);
        block_mark(block, ALLOCATED);
    }    
 }
예제 #2
0
/*
 * Return true if the lists are different.  Send an event for each different
 * device.
 */
static boolean_t
diff_mnttab(int send_event, struct mntpnt_list *firstp,
    struct mntpnt_list *secondp)
{
	boolean_t		different = B_FALSE;
	struct mntpnt_list	*listp;

	listp = firstp;
	while (listp != NULL) {
	    if (! in_list(listp, secondp)) {
		/* not in new list, so was mounted and now unmounted */
		if (send_event) {
		    events_new_slice_event(listp->special, DM_EV_TCHANGE);
		}
		different = B_TRUE;
	    }
	    listp = listp->next;
	}

	listp = secondp;
	while (listp != NULL) {
	    if (! in_list(listp, firstp)) {
		/* not in orig list, so this is a new mount */
		if (send_event) {
		    events_new_slice_event(listp->special, DM_EV_TCHANGE);
		}
		different = B_TRUE;
	    }
	    listp = listp->next;
	}

	return (different);
}
예제 #3
0
파일: LogReader.cpp 프로젝트: niru660/ardu
bool LogReader::handle_msg(const struct log_Format &f, uint8_t *msg) {
    char name[5];
    memset(name, '\0', 5);
    memcpy(name, f.name, 4);

    if (!in_list(name, generated_names)) {
        if (mapped_msgid[msg[2]] == 0) {
            printf("Unknown msgid %u\n", (unsigned)msg[2]);
            exit(1);
        }
        msg[2] = mapped_msgid[msg[2]];
        if (!in_list(name, nottypes)) {
            dataflash.WriteBlock(msg, f.length);        
        }
        // a MsgHandler would probably have found a timestamp and
        // caled stop_clock.  This runs IO, clearing dataflash's
        // buffer.
        hal.scheduler->stop_clock(last_timestamp_usec);
    }

    LR_MsgHandler *p = msgparser[f.type];
    if (p == NULL) {
	return true;
    }

    p->process_message(msg);

    maybe_install_vehicle_specific_parsers();

    return true;
}
예제 #4
0
void  AST_Node_Item::RemoveNodesManteining   (const mtk::list<std::string>& lNodes2mantein)
{
    //  si down es un elemento para eliminar...
        //  down =   down->next

    //  si next es un elemento para eliminar...
        //  next = next->next

    //  recursivo con down
    //  recursivo con next



    if (this->down.isValid())
    {
        //  si down es un elemento para eliminar...
        if (in_list(lNodes2mantein, this->down->name) == false)
        {
            //  down =   down->next
            if (this->down->next.isValid())
            {
                this->down = this->down->next;
                //  recursivo con down
                this->RemoveNodesManteining(lNodes2mantein);

            }
            else
                this->down = mtk::CountPtr<AST_Node_Item>();
        }
        else
        //  recursivo con down
            this->down->RemoveNodesManteining(lNodes2mantein);
    }


        //  si next es un elemento para eliminar...
        if (this->next.isValid())
        {
            if (in_list(lNodes2mantein, this->next->name) == false)
            {
                //  next =   next->next
                if (this->next->next.isValid())
                {
                    this->next = this->next->next;
                    this->RemoveNodesManteining(lNodes2mantein);
                }
                else
                    //  recursivo con next
                    this->next = mtk::CountPtr<AST_Node_Item>();
            }
            else
                //  recursivo con next
                this->next->RemoveNodesManteining(lNodes2mantein);

        }



}
예제 #5
0
/*
 * Merge block with adjacent free blocks
 * Return: the pointer to the new free block 
 */
static void *coalesce(void *block) {
    REQUIRES(block != NULL);
    REQUIRES(in_heap(block));

    uint32_t *prev_block = block_prev(block);
    uint32_t *next_block = block_next(block);
    int prev_free = block_free(prev_block);
    int next_free = block_free(next_block);
    unsigned int words = block_size(block);
    

    if (prev_free && next_free) {       // Case 4, both free

        block_delete(prev_block);
        block_delete(next_block);

        words += block_size(prev_block) + block_size(next_block) + 4;
        set_size(prev_block, words);
        block_mark(prev_block, FREE);
        block = (void *)prev_block;

        block_insert(block);
        ENSURES(in_list(block));    
    }

    else if (!prev_free && next_free) { // Case 2, next if free

        block_delete(next_block);

        words += block_size(next_block) + 2;
        set_size(block, words);
        block_mark(block, FREE);  

        block_insert(block);
        ENSURES(in_list(block));      
    }

    else if (prev_free && !next_free) { // Case 3, prev is free
        block_delete(prev_block);

        words += block_size(prev_block) + 2;
        set_size(prev_block, words);
        block_mark(prev_block, FREE);
        block = (void *)prev_block;

        block_insert(block);
        ENSURES(in_list(block));
    }

    else {                              // Case 1, both unfree
        block_insert(block);
        ENSURES(in_list(block));
        return block;
    }
    return block;
 } 
예제 #6
0
파일: lists.c 프로젝트: SKAcz/bics-current
int titled_player(int p,char* name)
{
	if ((in_list(p, L_FM, name)) ||
	    (in_list(p, L_IM, name)) ||
	    (in_list(p, L_GM, name)) ||
	    (in_list(p, L_WGM, name))) {
		return 1;
	}
	return 0;
}
예제 #7
0
파일: ntlm_auth.c 프로젝트: rti7743/samba
static void gensec_want_feature_list(struct gensec_security *state, char* feature_list)
{
	if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, true)) {
		DEBUG(10, ("want GENSEC_FEATURE_SESSION_KEY\n"));
		gensec_want_feature(state, GENSEC_FEATURE_SESSION_KEY);
	}
	if (in_list("NTLMSSP_FEATURE_SIGN", feature_list, true)) {
		DEBUG(10, ("want GENSEC_FEATURE_SIGN\n"));
		gensec_want_feature(state, GENSEC_FEATURE_SIGN);
	}
	if (in_list("NTLMSSP_FEATURE_SEAL", feature_list, true)) {
		DEBUG(10, ("want GENSEC_FEATURE_SEAL\n"));
		gensec_want_feature(state, GENSEC_FEATURE_SEAL);
	}
}
예제 #8
0
void in_int(TTPtr self, long value)
{
	t_atom a;
	
	atom_setlong(&a, value);
	in_list(self, _sym_int, 1, &a);
}
예제 #9
0
파일: ping.c 프로젝트: 9cat/ProjectTox-Core
/* Add nodes to the to_ping list.
 * All nodes in this list are pinged every TIME_TO_PING seconds
 * and are then removed from the list.
 * If the list is full the nodes farthest from our client_id are replaced.
 * The purpose of this list is to enable quick integration of new nodes into the
 * network while preventing amplification attacks.
 *
 *  return 0 if node was added.
 *  return -1 if node was not added.
 */
int add_to_ping(PING *ping, uint8_t *client_id, IP_Port ip_port)
{
    if (!ip_isset(&ip_port.ip))
        return -1;

    if (in_list(ping->dht->close_clientlist, LCLIENT_LIST, client_id, ip_port))
        return -1;

    uint32_t i;

    for (i = 0; i < MAX_TO_PING; ++i) {
        if (!ip_isset(&ping->to_ping[i].ip_port.ip)) {
            memcpy(ping->to_ping[i].client_id, client_id, CLIENT_ID_SIZE);
            ipport_copy(&ping->to_ping[i].ip_port, &ip_port);
            return 0;
        }

        if (memcmp(ping->to_ping[i].client_id, client_id, CLIENT_ID_SIZE) == 0) {
            return -1;
        }
    }

    uint32_t r = rand();

    for (i = 0; i < MAX_TO_PING; ++i) {
        if (id_closest(ping->dht->self_public_key, ping->to_ping[(i + r) % MAX_TO_PING].client_id, client_id) == 2) {
            memcpy(ping->to_ping[(i + r) % MAX_TO_PING].client_id, client_id, CLIENT_ID_SIZE);
            ipport_copy(&ping->to_ping[(i + r) % MAX_TO_PING].ip_port, &ip_port);
            return 0;
        }
    }

    return -1;
}
예제 #10
0
void parse_libextractor_output(struct hashtable *dst, const char *output, char **whitelist) {
	char **lines;
	int n_lines = split(output, "\n", &lines);
	char key[MAX_ATTRIB_LEN];
	char val[MAX_ATTRIB_LEN];

	printf("parse_libextractor_output: n_lines %i\n",n_lines);
	
	int i, j;
	for (i = 0; i < n_lines; i++) {
		char *line = lines[i];
		char *remain = strchr(line, '-');
		const char *ret;
		if (remain == NULL)
			continue;
		int keylen = remain - line;
		remain += 2; // skip '- '
		
		keylen = keylen > MAX_ATTRIB_LEN ? MAX_ATTRIB_LEN : keylen;
		strlcpy(key, line, keylen);
		strlcpy(val, remain, sizeof val);

		if ((ret=in_list(key, whitelist)) == NULL) {
			//warnx("ignoring attr %s - %s\n", key, val);
			continue;
		}

		hashtable_insert(dst, strdup(ret), strdup(val));
		//warnx("inserted attr %s - %s\n", key, val);
	}
	FreeSplitList(lines);
	printf("parse_libextractor_output: done\n");
}
예제 #11
0
void
elements_attached_to_NS(int *element_list,
			int NS_ID,
			Exo_DB *exo)
{
	int index;
	int num_nodes;
	int *ns_node_list;
	int i,j,I,e;
	
	if( (index = in_list( NS_ID, 0, exo->ns_node_len, exo->ns_id )) == -1 )
	{	
		EH(-1,"Node set ID not found\n");
	}
	
	num_nodes = exo->ns_num_nodes[index];
	
	ns_node_list = (int *) &( exo->ns_node_list[ exo->ns_node_index[index] ] ) ;				 
					 
	for( i=0, I=0; i< num_nodes; i++)
	{
		I = ns_node_list[i];
		
		for( j=exo->node_elem_pntr[I]; j< exo->node_elem_pntr[I+1]; j++ )
		{
			e = exo->node_elem_list[j];
			
			element_list[e] = TRUE;
		}
	}
	return;
}
예제 #12
0
/*
 * Extends the heap with a new free block
 * Return: the pointer to the new free block 
 *         NULL on error.
 */
static void *extend_heap(unsigned int words) {
    REQUIRES(words > 4);

    uint32_t *block;
    uint32_t *next;
    

    /* Ask for 2 more words for header and footer */
    words = (words % 2) ? (words + 1) : words;
    if (VERBOSE)
        printf("Extend Words = %d bytes\n", words * 4);
    if ((long)(block = mem_sbrk(words * WSIZE)) == -1)
        return NULL;

    block--;          // back step 1 since the last one is the epi block
    set_size(block, words - 2);
    block_mark(block, FREE);

    ENSURES(block != NULL);
    // New eqilogue block
    next = block_next(block);    
    set_size(next, 0);
    *next |= 0x40000000;
    //block_mark(block_next(block), ALLOCATED);

    ENSURES(!block_free(next));
    ENSURES(block_size(next) == 0);
    block = coalesce(block);    // Coalesce if necessary
    ENSURES(in_list(block));
    return block;
 }
예제 #13
0
		void slist_base_node::unlink(slist_base_node* prevNode)
		{
			RDE_ASSERT(in_list());
			RDE_ASSERT(prevNode->next == this);
			prevNode->next = next;
			next = this;
		}
예제 #14
0
파일: list.c 프로젝트: aboudreault/tinyows
/*
 * Add a given list to the end of a list
 * Careful list is passed by reference,
 * and must be free with list_free()
 */
void list_add_list(list * l, list * l_to_add)
{
    list_node *ln, *ln_parse;

    assert(l);
    assert(l_to_add);

    for (ln_parse = l_to_add->first ; ln_parse ; ln_parse = ln_parse->next) {
        if (!in_list(l, ln_parse->value)) {
            ln = list_node_init();

            ln->value = buffer_init();
            buffer_copy(ln->value, ln_parse->value);

            if (!l->first) {
                ln->prev = NULL;
                l->first = ln;
            } else {
                ln->prev = l->last;
                l->last->next = ln;
            }

            l->last = ln;
            l->last->next = NULL;
            l->size++;
        }
    }
}
예제 #15
0
		void list_base_node::unlink()
		{
			RDE_ASSERT(in_list());
			prev->next = next;
			next->prev = prev;
			next = prev = this;
		}
예제 #16
0
파일: ping.c 프로젝트: Dmdv/toxcore
/* Add nodes to the to_ping list.
 * All nodes in this list are pinged every TIME_TO_PING seconds
 * and are then removed from the list.
 * If the list is full the nodes farthest from our public_key are replaced.
 * The purpose of this list is to enable quick integration of new nodes into the
 * network while preventing amplification attacks.
 *
 *  return 0 if node was added.
 *  return -1 if node was not added.
 */
int add_to_ping(PING *ping, const uint8_t *public_key, IP_Port ip_port)
{
    if (!ip_isset(&ip_port.ip))
        return -1;

    if (in_list(ping->dht->close_clientlist, LCLIENT_LIST, public_key, ip_port))
        return -1;

    uint32_t i;

    for (i = 0; i < MAX_TO_PING; ++i) {
        if (!ip_isset(&ping->to_ping[i].ip_port.ip)) {
            memcpy(ping->to_ping[i].public_key, public_key, crypto_box_PUBLICKEYBYTES);
            ipport_copy(&ping->to_ping[i].ip_port, &ip_port);
            return 0;
        }

        if (memcmp(ping->to_ping[i].public_key, public_key, crypto_box_PUBLICKEYBYTES) == 0) {
            return -1;
        }
    }

    uint32_t r = rand();

    for (i = 0; i < MAX_TO_PING; ++i) {
        if (id_closest(ping->dht->self_public_key, ping->to_ping[(i + r) % MAX_TO_PING].public_key, public_key) == 2) {
            memcpy(ping->to_ping[(i + r) % MAX_TO_PING].public_key, public_key, crypto_box_PUBLICKEYBYTES);
            ipport_copy(&ping->to_ping[(i + r) % MAX_TO_PING].ip_port, &ip_port);
            return 0;
        }
    }

    return -1;
}
예제 #17
0
void in_float(TTPtr self, double value)
{
	t_atom a;
	
	atom_setfloat(&a, value);
	in_list(self, _sym_float, 1, &a);
}
예제 #18
0
		void list_base_node::link_before(list_base_node* nextNode)
		{
			RDE_ASSERT(!in_list());
			prev = nextNode->prev;
			prev->next = this;
			nextNode->prev = this;
			next = nextNode;
		}
예제 #19
0
apr_status_t h2_tq_remove(h2_task_queue *q, struct h2_task *task)
{
    if (in_list(q, task)) {
        H2_TASK_REMOVE(task);
        return APR_SUCCESS;
    }
    return APR_NOTFOUND;
}
예제 #20
0
bool LogReader::save_message_type(const char *name)
{
    bool save_message = !in_list(name, generated_names);
    if (save_chek_messages && strcmp(name, "CHEK") == 0) {
        save_message = true;
    }
    return save_message;
}
예제 #21
0
/**
 * Request features for the NTLMSSP negotiation
 *
 * @param ntlmssp_state NTLMSSP state
 * @param feature_list List of space seperated features requested from NTLMSSP.
 */
void ntlmssp_want_feature_list(NTLMSSP_STATE *ntlmssp_state, char *feature_list)
{
	/*
	 * We need to set this to allow a later SetPassword
	 * via the SAMR pipe to succeed. Strange.... We could
	 * also add  NTLMSSP_NEGOTIATE_SEAL here. JRA.
	 */
	if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, True)) {
		ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_SIGN;
	}
	if (in_list("NTLMSSP_FEATURE_SIGN", feature_list, True)) {
		ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_SIGN;
	}
	if(in_list("NTLMSSP_FEATURE_SEAL", feature_list, True)) {
		ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_SEAL;
	}
}
예제 #22
0
int main(void) {
    // create the wordlist dictionary
    Dictionary wordlist = create_Dictionary(strcmp_wrapper, free, do_nothing);
    StrQueue sq = file2StrQueue("wordlist.txt");
    while (sq_length(sq)) {
        char *word = sq_remove_front(sq);
        insert(wordlist, word, VALID);
    }
    destroy_StrQueue(sq);
    sq = NULL;
    
    Dictionary autocor = create_Dictionary(strcmp_wrapper, free, free);
    sq = file2StrQueue("autocorrect.txt");
    while (sq_length(sq)) {
        char *word = sq_remove_front(sq);
        char *val = sq_remove_front(sq);
        //printf("%s %s\n", word, val);
        insert(autocor, word, val);
    }
    destroy_StrQueue(sq);
    sq = NULL;
    
    sq = file2StrQueue(NULL);
    int flag = 0;
    while (sq_length(sq)) {
        
        char *word = sq_remove_front(sq);
        char *in_cor = lookup(autocor, word);
        //printf("%s\n", in_cor);
        if (not_word(word)) {
            printf("%s(unrecgonized)", word);
        } else if (in_list(wordlist, word)) {
            printf("%s", word);
        } else if (in_cor) {
            printf("%s(corrected)", in_cor);
        } else {
            printf("%s[not_in_list]", word);
        }
        flag++;
        // add a new line between every ten words
        if (flag - 10 == 0) {
            printf("\n");
            flag = 0;
        } else if (sq_length(sq)) {
            printf(" ");
        } else printf("\n");
        
        free(word);
    }
    
    
    
    // free memory
    destroy_StrQueue(sq);
    destroy_Dictionary(autocor);
    destroy_Dictionary(wordlist);
}
예제 #23
0
double
SummaryBalance::find_total (const std::vector<symbol>& names, 
                            int& max_digits) const
{
  double total = 0.0;
  for (size_t i = 0; i < fetch.size (); i++)
    if (in_list (i, names))
      max_digits = std::max (max_digits, fetch[i]->value_size (total));
  return total;
}
예제 #24
0
/** Instructions
 * This is a command line utility. It is desined to work with 
 * raw prdf data which is dumped to a text file. Each line of data 
 * dumped from a prdf to a text file must contain a minimum of a
 * unix time stamp, and an atp number. This code takes a list of 
 * dumped prdf segments as an argument, corrects the time offset
 * on the unix time stamp for each atp, and dumps the corrected data
 * out to files in a different directory.
 *
 * This utility does not have any functionality in terms of guessing
 * or being told what order your data is in, so you have to explitly
 * hard code it in, or, write a better utility, =).
 *
 * This ulility assumes that the events in each dumped prdf are 
 * in the same order as the events that were recorded in the prdf, 
 * and exploits this to assume rough time ordering. If you mess with
 * the ordering of your data,  this utiltiy will break. If you 
 * merge your segments before running over your data, this 
 * utility will break.
 *
 * Basic work flow:
 * 1) Dump each PRDF segment to its own text file
 * 2) create a file containing the full path to each segment + the
 *    segment's name, with one /<path>/seg_name.txt per line.
 * 3) Compile this utility, such as ":~> g++ correct_time.C -o correct_time.exe"
 * 4) Run the utility: ":~> correct_time.exe file_list.txt merged_corrected_data.txt"
 * Author: Mike Beaumier
 * Contac: [email protected]
 */
int main (int argc, char** argv){

	if(argc != 3) {
		std::cout << "example usage is " << argv[0] << "run_list.txt merged_data.txt"  << std::endl;
		return -1;
	}

	// setup each ATP and initialize
	int atptime[64];
	int atpcount[64];
	int atpcorr[64];

	for ( int i = 0; i < 64; i++){
		atptime[i] = 0;
		atpcount[i] = 0;
	}
	std::string atp_files = argv[1];
	std::cout << "  Loading PRDF dump list: " << atp_files << std::endl;
	std::ifstream in_list(atp_files.c_str());
	std::vector<std::string> file_list;
	std::string file = "";
	while(getline(in_list,file)) {
		std::cout << "    Got file name: " << atp_files << std::endl;
		file_list.push_back(file);
	}
	in_list.close();

	std::vector<std::string>::iterator file_i;
	for(file_i = file_list.begin(); file_i != file_list.end(); ++file_i) {
		int count = 0;
		std::cout << "Getting time offset for file: " << *file_i << std::endl;
		std::ifstream in_file((*file_i).c_str());

		if(in_file) {
			std::string line = "";
			while(getline(in_file,line) && count++ < 20000) {
				std::stringstream ss;
				long int time_stamp;
				int atp_num;
				long int evt_num;
				ss.str(line);
				ss >> evt_num >> atp_num >> time_stamp; 
				// only do a partial extraction here, we don't need the rest yet
				// Here, we just find the first instance of the ATP being used.
				if ( atp_num < 64 && atpcount[atp_num] == 0 ) {
					atptime[ atp_num ] +=  time_stamp ;
					atpcount[ atp_num ]++;
				}
			}
			std::cout << "  done" << std::endl;
		}
		else {
			std::cout << "can't open " << *file_i << std::endl;    
		}
	}
예제 #25
0
/*
 * Détermine si un mot se trouve dans la hash table
 * @param dico : la hash table dans laquelle chercher
 * @param mot : le mot à rechercher
 * @return 1 si mot se trouve dans dico, 0 sinon
 */
int contient(HashTable* dico, char* mot)
{
	int index = 0 ;

	if(mot == NULL || dico == NULL)
		return 0 ;

	if((index = hash(mot)) == -1)
		return 0 ;

	return in_list(mot, dico->contenu[index]) ;
}
예제 #26
0
static void sort_ascending(int Npartners, int *dep, int *ref, int *pivot){

  int i,j,k;
  int *dep_tmp,*ref_tmp,*list;
  dep_tmp = (int *) malloc(Npartners*sizeof(int));
  ref_tmp = (int *) malloc(Npartners*sizeof(int));
  list = (int *) malloc(Npartners*sizeof(int));

  memcpy(dep_tmp,dep,Npartners*sizeof(int));
  memcpy(ref_tmp,ref,Npartners*sizeof(int));

  for (i = 0; i < Npartners; i++)
     list[i] = -1;

  qsort(ref,Npartners,sizeof(int),compare);

  k = 0;
  for (i = 0; i < Npartners; i++){
    for (j = 0; j < Npartners; j++){
      if (ref[i] == ref_tmp[j]){
        if (in_list(Npartners,list,j) != 1){
          dep[i] = dep_tmp[j];
          list[k] = j;
          k++;
          break;
        }
      }
    }
  }
  free(list);

  int my_rank;
  MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

/*
  for (i = 0; i < Npartners; i++)
    fprintf(stderr,"my_rank = %d::: [%d  %d]  [%d  %d] \n",my_rank,dep_tmp[i],ref_tmp[i],dep[i],ref[i]);
*/

   /* set up pivot table */
   for (i = 0; i < Npartners; i++)
     for (j = 0; j < Npartners; j++){
       if (dep_tmp[i] == dep[j]){
         pivot[i] = j;
         break;
       }
     }

  memcpy(ref,ref_tmp,Npartners*sizeof(int));

  free(dep_tmp);
  free(ref_tmp);
}
예제 #27
0
/*
 * Check whether the request satisfies the conditions for generating a referral
 * TGT.  The caller checks whether the hostname component looks like a FQDN.
 */
static krb5_boolean
is_referral_req(kdc_realm_t *kdc_active_realm, krb5_kdc_req *request)
{
    krb5_boolean ret = FALSE;
    char *stype = NULL;
    char *hostbased = kdc_active_realm->realm_hostbased;
    char *no_referral = kdc_active_realm->realm_no_referral;

    if (!(request->kdc_options & KDC_OPT_CANONICALIZE))
        return FALSE;

    if (request->kdc_options & KDC_OPT_ENC_TKT_IN_SKEY)
        return FALSE;

    if (krb5_princ_size(kdc_context, request->server) != 2)
        return FALSE;

    stype = data2string(krb5_princ_component(kdc_context, request->server, 0));
    if (stype == NULL)
        return FALSE;
    switch (krb5_princ_type(kdc_context, request->server)) {
    case KRB5_NT_UNKNOWN:
        /* Allow referrals for NT-UNKNOWN principals, if configured. */
        if (!in_list(hostbased, stype) && !in_list(hostbased, "*"))
            goto cleanup;
        /* FALLTHROUGH */
    case KRB5_NT_SRV_HST:
    case KRB5_NT_SRV_INST:
        /* Deny referrals for specific service types, if configured. */
        if (in_list(no_referral, stype) || in_list(no_referral, "*"))
            goto cleanup;
        ret = TRUE;
        break;
    default:
        goto cleanup;
    }
cleanup:
    free(stype);
    return ret;
}
예제 #28
0
void
add_libs_so(int argc, char **argv)
{
	int i;

	for(i = 1; i < argc; i++) {
		add_string(&libs_so, argv[i]);
		if ( in_list(&libs, argv[i]) )
			warnx("%s:%d: "
				"library `%s' specified as static earlier",
				curfilename, linenum, argv[i]);
	}
}
예제 #29
0
int
subtract_strlst(strlst_t **lista, strlst_t **listb)
{
	int subtract_count = 0;
	strlst_t *p1;
	for (p1 = *listb; p1 != NULL; p1 = p1->next)
		if ( in_list(lista, p1->str) ) {
			warnx("Will compile library `%s' dynamically", p1->str);
			strcat(p1->str, "");
			subtract_count++;
		}
	return subtract_count;
}
예제 #30
0
bool armcc_cmdlinet::parse(int argc, const char **argv)
{
  for(int i=1; i<argc; i++)
  {
    if(strcmp(argv[i], "-")==0 ||
       argv[i][0]!='-')
    {
      args.push_back(argv[i]);
      continue;
    }

    // it starts with - and it isn't "-"

    std::string prefix;

    if(in_list(argv[i], options_no_arg))
    {
      // options that don't have any arguments
      set(argv[i]);
    }
    else if(prefix_in_list(argv[i], options_with_arg, prefix))
    {
      // options that have a separated _or_ concatenated argument
      if(strlen(argv[i])>prefix.size()) // concatenated?
        set(prefix, std::string(argv[i], prefix.size(), std::string::npos));
      else
      {
        // Separated.
        if(i!=argc-1) // Guard against end of command line.
        {
          set(prefix, argv[i+1]);
          i++;
        }
        else
          set(prefix, "");
      }
    }
    else if(prefix_in_list(argv[i], options_with_prefix, prefix))
    {
      // options that have a concatenated argument
      set(prefix, std::string(argv[i], prefix.size(), std::string::npos));
    }
    else
    { // unrecognized option
      std::cout << "Warning: uninterpreted armcc option '"
                << argv[i] << "'" << std::endl;
    }
  }

  return false;
}