コード例 #1
0
ファイル: auth.c プロジェクト: FlameN/STM32RUNO
/*
 * We have failed to authenticate ourselves to the peer using `protocol'.
 */
void
auth_withpeer_fail(int unit, u16_t protocol)
{
  int errCode = PPPERR_AUTHFAIL;

  LWIP_UNUSED_ARG(protocol);

  AUTHDEBUG((LOG_INFO, "auth_withpeer_fail: %d proto=%X\n", unit, protocol));
  if (passwd_from_file) {
    BZERO(ppp_settings.passwd, MAXSECRETLEN);
  }
  /*
   * XXX Warning: the unit number indicates the interface which is
   * not necessarily the PPP connection.  It works here as long
   * as we are only supporting PPP interfaces.
   */
  pppIOCtl(unit, PPPCTLS_ERRCODE, &errCode);

  /*
   * We've failed to authenticate ourselves to our peer.
   * He'll probably take the link down, and there's not much
   * we can do except wait for that.
   */
  lcp_close(unit, "Authentication failed");
}
コード例 #2
0
ファイル: mark_rts.c プロジェクト: fiery-/w3m
 STATIC void GC_rebuild_root_index(void)
 {
   int i;
   BZERO(GC_root_index, RT_SIZE * sizeof(void *));
   for (i = 0; i < n_root_sets; i++)
       add_roots_to_index(GC_static_roots + i);
 }
コード例 #3
0
ファイル: misc.c プロジェクト: FrodeSolheim/fs-uae
/*
 * saving what's found. Mainly music file here.
 * PW_Start_Address & OutputSize are global .. not everybody likes
 * that :(. I just cant seem to manage it otherwise.
*/
void Save_Rip ( char * format_to_save, int FMT_EXT )
{
  Save_Status = BAD;
  pw_write_log ( "%s found at %ld !. its size is : %ld\n", format_to_save , PW_Start_Address , OutputSize );
  if ( (PW_Start_Address + (long)OutputSize) > PW_in_size )
  {
    pw_write_log ( "!!! Truncated, missing (%ld byte(s) !)\n"
             , (PW_Start_Address+OutputSize)-PW_in_size );
    PW_i += 2 ;
    return;
  }
  BZERO ( OutName_final, sizeof OutName_final);
  sprintf ( OutName_final , "%ld.%s" , Cpt_Filename , Extensions[FMT_EXT] );
  pw_write_log ( "  saving in file \"%s\" ... " , OutName_final );
  Cpt_Filename += 1;
  PW_out = moduleripper2_fopen ( OutName_final , "w+b", format_to_save, PW_Start_Address, OutputSize);
  //PW_out = PW_fopen ( OutName_final , "w+b" );
  if (!PW_out)
      return;
  fwrite ( &in_data[PW_Start_Address] , OutputSize , 1 , PW_out );
  fclose ( PW_out );
  pw_write_log ( "done\n" );
  if ( CONVERT == GOOD )
  {
    pw_write_log ( "  converting to Protracker ... " );
  }
  //fflush ( stdout );
  Save_Status = GOOD;
}
コード例 #4
0
ファイル: chpms.c プロジェクト: malooei/yeejoin-workspace
void
ChapMS( chap_state *cstate, char *rchallenge, int rchallenge_len, char *secret, int secret_len)
{
	MS_ChapResponse response;
#ifdef MSLANMAN
	extern int ms_lanman;
#endif

#if 0
	CHAPDEBUG(LOG_INFO, ("ChapMS: secret is '%.*s'\n", secret_len, secret));
#endif
	BZERO(&response, sizeof(response));

	/* Calculate both always */
	ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response);

#ifdef MSLANMAN
	ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response);

	/* prefered method is set by option  */
	response.UseNT = !ms_lanman;
#else
	response.UseNT = 1;
#endif

	BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN);
	cstate->resp_length = MS_CHAP_RESPONSE_LEN;
}
コード例 #5
0
ファイル: mvfs_linux_iops.c プロジェクト: dagwieers/mvfs71
STATIC void
vnlayer_linux_vattr2kstat(
    VATTR_T *src,
    struct kstat *dst
)
{
    BZERO(dst, sizeof(*dst));

    /* We could assume all the "pullup" stuff happened in getattr so the inode
    ** matches what we have in the vattr and then use generic_fillattr(ip, dst)
    ** (and fix the dev field since it's not in the inode anymore).  However,
    ** there could be a race on vob roots if we did that, so just get
    ** everything out of the passed in vattr structure.
    */
#define GET(lll, UUU) dst->lll = VATTR_GET_ ## UUU(src)
#define GET_TIME(lll, UUU) VATTR_GET_ ## UUU ## _TS(src, &(dst->lll))

    GET(dev, FSID);
    GET(ino, NODEID);
    GET(mode, MODE);
    dst->mode |= vnlayer_vtype_to_mode(VATTR_GET_TYPE(src));
    GET(nlink, NLINK);
    GET(uid, UID);
    GET(gid, GID);
    GET(rdev, RDEV);
    GET_TIME(atime, ATIME);
    GET_TIME(mtime, MTIME);
    GET_TIME(ctime, CTIME);
    GET(size, SIZE);
    GET(blocks, NBLOCKS);
    GET(blksize, BLKSIZE);

#undef GET_TIME
#undef GET
}
コード例 #6
0
ファイル: misc.c プロジェクト: FrodeSolheim/fs-uae
/*
 * Special cases for files with header to rebuild ...
 *
*/
void Save_Rip_Special ( char * format_to_save, int FMT_EXT, Uchar * Header_Block , Ulong Block_Size )
{
  Save_Status = BAD;
  pw_write_log ( "%s found at %ld !. its size is : %ld\n", format_to_save , PW_Start_Address , OutputSize );
  if ( (PW_Start_Address + (long)OutputSize) > PW_in_size )
  {
    pw_write_log ( "!!! Truncated, missing (%ld byte(s) !)\n"
             , (PW_Start_Address+OutputSize)-PW_in_size );
    PW_i += 2 ;
    return;
  }
  BZERO (OutName_final, sizeof OutName_final);
  sprintf ( OutName_final , "%ld.%s" , Cpt_Filename , Extensions[FMT_EXT] );
  pw_write_log ( "  saving in file \"%s\" ... " , OutName_final );
  Cpt_Filename += 1;
//  PW_out = PW_fopen ( OutName_final , "w+b" );
  PW_out = moduleripper2_fopen ( OutName_final , "w+b", format_to_save, PW_Start_Address, OutputSize );
  fwrite ( Header_Block , Block_Size  , 1 , PW_out );
  fwrite ( &in_data[PW_Start_Address] , OutputSize , 1 , PW_out );
  fclose ( PW_out );
  pw_write_log ( "done\n" );
  if ( CONVERT == GOOD )
  {
    pw_write_log ( "  converting to Protracker ... " );
  }
  pw_write_log ( "  Header of this file was missing and has been rebuilt !\n" );
  if ( FMT_EXT == DragPack252)
    pw_write_log ( "  WARNING !: it's a fake header since in this case !!\n" );
  //fflush ( stdout );
  Amiga_EXE_Header = GOOD;
  Save_Status = GOOD;
}
コード例 #7
0
ファイル: chpms.c プロジェクト: malooei/yeejoin-workspace
static void
ChapMS_NT( char *rchallenge,
		   int rchallenge_len,
		   char *secret,
		   int secret_len,
		   MS_ChapResponse *response)
{
	int      i;
	MDstruct  md4Context;
	u_char    unicodePassword[MAX_NT_PASSWORD * 2];
	static int  low_byte_first = -1;

	LWIP_UNUSED_ARG(rchallenge_len);

	/* Initialize the Unicode version of the secret (== password). */
	/* This implicitly supports 8-bit ISO8859/1 characters. */
	BZERO(unicodePassword, sizeof(unicodePassword));
	for (i = 0; i < secret_len; i++) {
		unicodePassword[i * 2] = (u_char)secret[i];
	}
	MDbegin(&md4Context);
	MDupdate(&md4Context, unicodePassword, secret_len * 2 * 8);  /* Unicode is 2 bytes/char, *8 for bit count */

	if (low_byte_first == -1) {
		low_byte_first = (PP_HTONS((unsigned short int)1) != 1);
	}
	if (low_byte_first == 0) {
		/* @todo: arg type - u_long* or u_int* ? */
		MDreverse((unsigned int*)&md4Context);  /*  sfb 961105 */
	}

	MDupdate(&md4Context, NULL, 0);  /* Tell MD4 we're done */

	ChallengeResponse((u_char*)rchallenge, (u_char*)md4Context.buffer, response->NTResp);
}
コード例 #8
0
// Test case: TestArgs:1
// This test case calls reloadIndexFromFile() and lookUp() and 
// checks to make sure that all arguments are processed
// by the query engine successfully
int TestArgs1() {
  START_TEST_CASE;

  int lookUpResult = 0;

  create();

  INVERTED_INDEX* result = NULL;
  result = reloadIndexFromFile("../indexer_dir/index.dat", indexReload);
  SHOULD_BE(result != NULL);
  LOG("Reloading INVERTED INDEX structure");

  char query[1000] = "andrew";
  sanitize(query);

  char* queryList[1000];
  curateWords(queryList, query);
  SHOULD_BE(strcmp(queryList[0], "andrew") == 0);

  sanitizeKeywords(queryList); 
  SHOULD_BE(strcmp(queryList[0], "andrew") == 0);

  DocumentNode* saved[1000];
  BZERO(saved, 1000);
  lookUp(saved, queryList, indexReload);

  lookUpResult = rankAndPrint(saved, "../crawler_dir/data"); 

  SHOULD_BE(lookUpResult == 1);

  cleanUpQueryList(queryList);
  cleanUpIndex(indexReload);

  END_TEST_CASE;
}
コード例 #9
0
// Test case: TestRanking:1
// This test case calls rankByFrequency() for the condition the DocumentNode
// page frequencies are different and need to be ranked accordingly
int TestRanking1() {
  START_TEST_CASE;

  DocumentNode* list1[1000];
  BZERO(list1, 1000);

  DocumentNode* docNode = NULL;
  docNode = newDocNode(docNode, 1, 1);

  DocumentNode* docNode2 = NULL;
  docNode2 = newDocNode(docNode2, 16, 2);

  DocumentNode* docNode3 = NULL;
  docNode3 = newDocNode(docNode3, 1, 3);

  DocumentNode* docNode4 = NULL;
  docNode4 = newDocNode(docNode4, 1, 4);

  list1[0] = docNode4;
  list1[1] = docNode3;
  list1[2] = docNode2;
  list1[3] = docNode;

  rankByFrequency(list1, 0, 3);

  free(docNode);
  free(docNode2);
  free(docNode3);
  free(docNode4);

  END_TEST_CASE;
}
コード例 #10
0
//takes in an array of search terms, gets the docID, score, and which list it should be added in
//and passes the information to the function addScoreToList to be added to the list
//
//PSEUDO CODE
//for all searchterms
//    get the docIDs associated with the word and add the score to the list but factor in a WEIGHT
//    if the prev searchterm is not OR
//	 add to list with weight
//    else
//	 add to the list
void processSearchTerms(INVERTED_INDEX* index, char* searchterms) {
    int docID;
    int score;
    char* prevterm = NULL;
    char* currentterm;
    int pos;
    DOCNODE* d;
    while (searchterms != NULL) {
        currentterm = searchterms;
        pos = 0;
        if(isSearchTerm(currentterm) == TRUE) { //if it's a search term, normalize it and search for it
            NormalizeWord(currentterm);
            while((d = getDoc(index, currentterm, &pos)) != NULL) {
                docID = d->doc_id;
                score = d->page_word_freq;
                if(isNotOR(prevterm) == TRUE) { //add with weighteded score because it must be ADD
                    addScoreToList(querylist, TRUE, docID, (score*WEIGHT));
                }
                else//add with regular score
                    addScoreToList(querylist, FALSE, docID, score);
            }
        }
        prevterm = currentterm;
        searchterms = strtok(NULL, " "); //get next searchterm
    }
    if (querylist->start != NULL) {
        slist = NEW(SORTLIST);
        MALLOC_CHECK(slist);
        BZERO(slist, sizeof(SORTLIST));
        sortList(slist, querylist);
        printList(slist);
    }
}
コード例 #11
0
ファイル: auth.c プロジェクト: eslinux/network_model
/*
 * We have successfully authenticated ourselves with the peer using `protocol'.
 */
void auth_withpeer_success(int unit, u16_t protocol)
{
    int pbit;
    
    AUTHDEBUG((LOG_INFO, "auth_withpeer_success: %d proto=%X\n", unit, protocol));
    switch (protocol) {
    case PPP_CHAP:
        pbit = CHAP_WITHPEER;
        break;
    case PPP_PAP:
        if (passwd_from_file)
            BZERO(ppp_settings.passwd, MAXSECRETLEN);
        pbit = PAP_WITHPEER;
        break;
    default:
        ppp_trace(LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
               protocol);
        pbit = 0;
    }
    
    /*
     * If there is no more authentication still being done,
     * proceed to the network (or callback) phase.
     */
    if ((auth_pending[unit] &= ~pbit) == 0)
        network_phase(unit);
}
コード例 #12
0
ファイル: malloc.c プロジェクト: crystal-lang/bdwgc
/* Explicitly deallocate an object p.                           */
GC_API void GC_CALL GC_free(void * p)
{
    struct hblk *h;
    hdr *hhdr;
    size_t sz; /* In bytes */
    size_t ngranules;   /* sz in granules */
    void **flh;
    int knd;
    struct obj_kind * ok;
    DCL_LOCK_STATE;

    if (p == 0) return;
    /* Required by ANSI.  It's not my fault ...     */
#   ifdef LOG_ALLOCS
    GC_log_printf("GC_free(%p) after GC #%lu\n",
                  p, (unsigned long)GC_gc_no);
#   endif
    h = HBLKPTR(p);
    hhdr = HDR(h);
#   if defined(REDIRECT_MALLOC) && \
        (defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \
         || defined(MSWIN32))
    /* For Solaris, we have to redirect malloc calls during         */
    /* initialization.  For the others, this seems to happen        */
    /* implicitly.                                                  */
    /* Don't try to deallocate that memory.                         */
    if (0 == hhdr) return;
#   endif
    GC_ASSERT(GC_base(p) == p);
    sz = hhdr -> hb_sz;
    ngranules = BYTES_TO_GRANULES(sz);
    knd = hhdr -> hb_obj_kind;
    ok = &GC_obj_kinds[knd];
    if (EXPECT(ngranules <= MAXOBJGRANULES, TRUE)) {
        LOCK();
        GC_bytes_freed += sz;
        if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz;
        /* Its unnecessary to clear the mark bit.  If the       */
        /* object is reallocated, it doesn't matter.  O.w. the  */
        /* collector will do it, since it's on a free list.     */
        if (ok -> ok_init) {
            BZERO((word *)p + 1, sz-sizeof(word));
        }
        flh = &(ok -> ok_freelist[ngranules]);
        obj_link(p) = *flh;
        *flh = (ptr_t)p;
        UNLOCK();
    } else {
        size_t nblocks = OBJ_SZ_TO_BLOCKS(sz);
        LOCK();
        GC_bytes_freed += sz;
        if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz;
        if (nblocks > 1) {
            GC_large_allocd_bytes -= nblocks * HBLKSIZE;
        }
        GC_freehblk(h);
        UNLOCK();
    }
}
コード例 #13
0
ファイル: parse.c プロジェクト: jkdewar/rook
/*----------------------------------------------------------------------*/
static ast_expression_t *parse_function_call(parse_state_t *p) {
    token_t *token;
    ast_expression_t *expression;
    ast_expression_list_t *param, *new_param;

    expression = ALLOC(sizeof(ast_expression_t));
    BZERO(expression);

    expression->tag = AST_EXPRESSION_FUNCTION_CALL;
    /* function identifier */
    token = next_token(p);
    EXPECT(token, TK_IDENTIFIER, "function name expected");
    expression->u.function_call.identifier = token;

    /* opening bracket */
    token = next_token(p);
    EXPECT(token, TK_LBRACKET, "'(' expected");

    /* parameter list */
    param = NULL;
    expression->u.function_call.parameter_count = 0;
    for (;;) {
        token = peek_token(p);
        if (test_token(token, TK_RBRACKET))
            break;

        /* parameter */
        new_param = ALLOC(sizeof(ast_expression_list_t));
        new_param->next = NULL;
        new_param->expr = parse_logical_expression(p);
        if (new_param->expr == NULL)
            error(p, "expression expected");
        if (param == NULL) {
            expression->u.function_call.parameter_expr_list = new_param;
        } else {
            param->next = new_param;
        }
        param = new_param;
        expression->u.function_call.parameter_count += 1;

        /* comma? */
        token = peek_token(p);
        if (test_token(token, TK_RBRACKET))
            break;

        if (test_token(token, TK_COMMA)) {
            next_token(p);
            continue;
        }

        error(p, "',' or ')' expected");
    }

    /* closing bracket */
    token = next_token(p);
    EXPECT(token, TK_RBRACKET, "')' expected");

    return expression;
}
コード例 #14
0
ファイル: new_hblk.c プロジェクト: ExpressOS/third_party-l4re
/* we have not yet allocated.                                           */
GC_INNER ptr_t GC_build_fl(struct hblk *h, size_t sz, GC_bool clear,
                           ptr_t list)
{
  word *p, *prev;
  word *last_object;            /* points to last object in new hblk    */

  /* Do a few prefetches here, just because its cheap.          */
  /* If we were more serious about it, these should go inside   */
  /* the loops.  But write prefetches usually don't seem to     */
  /* matter much.                                               */
    PREFETCH_FOR_WRITE((ptr_t)h);
    PREFETCH_FOR_WRITE((ptr_t)h + 128);
    PREFETCH_FOR_WRITE((ptr_t)h + 256);
    PREFETCH_FOR_WRITE((ptr_t)h + 378);
  /* Handle small objects sizes more efficiently.  For larger objects   */
  /* the difference is less significant.                                */
#  ifndef SMALL_CONFIG
     switch (sz) {
        case 2: if (clear) {
                    return GC_build_fl_clear2(h, list);
                } else {
                    return GC_build_fl2(h, list);
                }
        case 4: if (clear) {
                    return GC_build_fl_clear4(h, list);
                } else {
                    return GC_build_fl4(h, list);
                }
        default:
                break;
     }
#  endif /* !SMALL_CONFIG */

  /* Clear the page if necessary. */
    if (clear) BZERO(h, HBLKSIZE);

  /* Add objects to free list */
    p = (word *)(h -> hb_body) + sz;    /* second object in *h  */
    prev = (word *)(h -> hb_body);              /* One object behind p  */
    last_object = (word *)((char *)h + HBLKSIZE);
    last_object -= sz;
                            /* Last place for last object to start */

  /* make a list of all objects in *h with head as last object */
    while (p <= last_object) {
      /* current object's link points to last object */
        obj_link(p) = (ptr_t)prev;
        prev = p;
        p += sz;
    }
    p -= sz;                    /* p now points to last object */

  /*
   * put p (which is now head of list of objects in *h) as first
   * pointer in the appropriate free list for this size.
   */
      obj_link(h -> hb_body) = list;
      return ((ptr_t)p);
}
コード例 #15
0
ファイル: pciio.c プロジェクト: hugh712/Jollen
void
pciio_device_info_free(pciio_info_t pciio_info)
{
    /* NOTE : pciio_info is a structure within the pcibr_info
     *	      and not a pointer to memory allocated on the heap !!
     */
    BZERO((char *)pciio_info,sizeof(pciio_info));
}
コード例 #16
0
ファイル: sgi_if.c プロジェクト: dduval/kernel-rhel3
void *
snia_kmem_zalloc_node(register size_t size, register int flags, cnodeid_t node)
{
	void *ptr = kmalloc(size, GFP_KERNEL);
	if ( ptr )
		BZERO(ptr, size);
        return(ptr);
}
コード例 #17
0
ファイル: parse.c プロジェクト: jkdewar/rook
/*----------------------------------------------------------------------*/
static ast_expression_t *parse_variable(parse_state_t *p) {
    token_t *token = next_token(p);
    ast_expression_t *expression = ALLOC(sizeof(ast_expression_t));
    BZERO(expression);
    expression->tag = AST_EXPRESSION_VARIABLE;
    expression->u.variable.token = token;
    return expression;
}
コード例 #18
0
ファイル: sgi_if.c プロジェクト: dduval/kernel-rhel3
void *
snia_kmem_zalloc(size_t size, int flag)
{
        void *ptr = kmalloc(size, GFP_KERNEL);
	if ( ptr )
        	BZERO(ptr, size);
        return(ptr);
}
コード例 #19
0
//initializes the querylist
void initQueryList() {
    querylist = NEW(QUERYLIST);
    MALLOC_CHECK(querylist);
    BZERO(querylist, sizeof(QUERYLIST));
    querylist->start = querylist->end = NULL;
    for (int i = 0; i < MAX_HASH_SLOT; i++)
        querylist->hash[i] = NULL;
}
コード例 #20
0
ファイル: parse.c プロジェクト: jkdewar/rook
/*----------------------------------------------------------------------*/
static ast_expression_t *parse_literal(parse_state_t *p) {
    token_t *token = next_token(p);
    ast_expression_t *expression = ALLOC(sizeof(ast_expression_t));
    BZERO(expression);
    expression->tag = AST_EXPRESSION_LITERAL;
    expression->u.literal.token = token;
    return expression;
}
コード例 #21
0
ファイル: eden_lib.c プロジェクト: SlavaC1/ControlSW
/* -----------------------------------------------
    Device open/close
   ----------------------------------------------- */
WDC_DEVICE_HANDLE EDEN_DeviceOpen(const WD_PCI_CARD_INFO *pDeviceInfo)
{
    DWORD dwStatus;
    PEDEN_DEV_CTX pDevCtx = NULL;
    WDC_DEVICE_HANDLE hDev = NULL;
    EDEN_DEV_ADDR_DESC devAddrDesc;
    PWDC_DEVICE pDev;

    /* Validate arguments */
    if (!pDeviceInfo)
    {
        ErrLog("EDEN_DeviceOpen: Error - NULL device information struct pointer\n");
        return NULL;
    }

    /* Allocate memory for the EDEN device context */
    pDevCtx = (PEDEN_DEV_CTX)malloc(sizeof (EDEN_DEV_CTX));
    if (!pDevCtx)
    {
        ErrLog("Failed allocating memory for EDEN device context\n");
        return NULL;
    }

    BZERO(*pDevCtx);

    /* Open a WDC device handle */
    dwStatus = WDC_PciDeviceOpen(&hDev, pDeviceInfo, pDevCtx, NULL, NULL, NULL);
    if (WD_STATUS_SUCCESS != dwStatus)
    {
        ErrLog("Failed opening a WDC device handle. Error 0x%lx - %s\n",
            dwStatus, Stat2Str(dwStatus));
        goto Error;
    }

    pDev = hDev;
    devAddrDesc.dwNumAddrSpaces = pDev->dwNumAddrSpaces;
    devAddrDesc.pAddrDesc = pDev->pAddrDesc;

    /* Open a handle to a Kernel PlugIn driver */
    WDC_KernelPlugInOpen(hDev, KP_EDEN_DRIVER_NAME, &devAddrDesc);

    /* Validate device information */
    if (!DeviceValidate((PWDC_DEVICE)hDev))
        goto Error;

    /* Return handle to the new device */
    TraceLog("EDEN_DeviceOpen: Opened a EDEN device (handle 0x%p)\n"
        "Device uses a Kernel PlugIn driver (%s)\n", hDev, KP_EDEN_DRIVER_NAME);
    return hDev;

Error:    
    if (hDev)
        EDEN_DeviceClose(hDev);
    else
        free(pDevCtx);

    return NULL;
}
コード例 #22
0
ファイル: auth.c プロジェクト: 10code/lwip
/*
 * get_secret - open the CHAP secret file and return the secret
 * for authenticating the given client on the given server.
 * (We could be either client or server).
 */
int
get_secret(int unit, char *client, char *server, char *secret, int *secret_len, int save_addrs)
{
#if 1
  int len;
  struct wordlist *addrs;

  LWIP_UNUSED_ARG(unit);
  LWIP_UNUSED_ARG(server);
  LWIP_UNUSED_ARG(save_addrs);

  addrs = NULL;

  if(!client || !client[0] || strcmp(client, ppp_settings.user)) {
    return 0;
  }

  len = (int)strlen(ppp_settings.passwd);
  if (len > MAXSECRETLEN) {
    AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
    len = MAXSECRETLEN;
  }

  BCOPY(ppp_settings.passwd, secret, len);
  *secret_len = len;

  return 1;
#else
  int ret = 0, len;
  struct wordlist *addrs;
  char secbuf[MAXWORDLEN];
  
  addrs = NULL;
  secbuf[0] = 0;

  /* XXX Find secret. */
  if (ret < 0) {
    return 0;
  }

  if (save_addrs) {
    set_allowed_addrs(unit, addrs);
  }

  len = strlen(secbuf);
  if (len > MAXSECRETLEN) {
    AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
    len = MAXSECRETLEN;
  }

  BCOPY(secbuf, secret, len);
  BZERO(secbuf, sizeof(secbuf));
  *secret_len = len;

  return 1;
#endif
}
コード例 #23
0
ファイル: malloc.c プロジェクト: preames/hinted-collection
/* Return TRUE on success               */
STATIC GC_bool GC_alloc_reclaim_list(struct obj_kind *kind)
{
    struct hblk ** result = (struct hblk **)
                GC_scratch_alloc((MAXOBJGRANULES+1) * sizeof(struct hblk *));
    if (result == 0) return(FALSE);
    BZERO(result, (MAXOBJGRANULES+1)*sizeof(struct hblk *));
    kind -> ok_reclaim_list = result;
    return(TRUE);
}
コード例 #24
0
ファイル: chap_ms.c プロジェクト: jhbsz/DIR-850L_A1
/*
 * Convert the ASCII version of the password to Unicode.
 * This implicitly supports 8-bit ISO8859/1 characters.
 * This gives us the little-endian representation, which
 * is assumed by all M$ CHAP RFCs.  (Unicode byte ordering
 * is machine-dependent.)
 */
static void
ascii2unicode(char ascii[], int ascii_len, u_char unicode[])
{
    int i;

    BZERO(unicode, ascii_len * 2);
    for (i = 0; i < ascii_len; i++)
        unicode[i * 2] = (u_char) ascii[i];
}
コード例 #25
0
// Test case: TestCurate:2
// This test case calls curateWords() for the condition where the query
// are invalid (non-alpha characters).
int TestCurate2() {
  START_TEST_CASE;

  char empty[1000] = "$$";
  sanitize(empty);

  char* list[1000];
  BZERO(list, 1000);
  list[0] = (char*) malloc(sizeof(char) * 1000);
  BZERO(list[0], 1000); 

  curateWords(list, empty);

  SHOULD_BE(strcmp(list[0], "") == 0);

  free(list[0]);
  END_TEST_CASE;
}
コード例 #26
0
ファイル: headers.c プロジェクト: ExpressOS/third_party-l4re
GC_INNER void GC_init_headers(void)
{
    register unsigned i;

    GC_all_nils = (bottom_index *)GC_scratch_alloc((word)sizeof(bottom_index));
    BZERO(GC_all_nils, sizeof(bottom_index));
    for (i = 0; i < TOP_SZ; i++) {
        GC_top_index[i] = GC_all_nils;
    }
}
コード例 #27
0
ファイル: pcr_interface.c プロジェクト: PaulBone/bdwgc
void * GC_AllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear )
{
    if (ptrFree) {
        void * result = (void *)GC_malloc_atomic(size);
        if (clear && result != 0) BZERO(result, size);
        return(result);
    } else {
        return((void *)GC_malloc(size));
    }
}
コード例 #28
0
void				
Comm_Close( com_t *com )
{
	if( com && !Comm_State(com) )
		return;
	
	//	close gps comm device
	CloseHandle( com->priv );
	BZERO( com, com_t );
}
コード例 #29
0
ファイル: auth.c プロジェクト: juanfra684/DragonFlyBSD
/*
 * We have failed to authenticate ourselves to the peer using `protocol'.
 */
void
auth_withpeer_fail(int unit, int protocol)
{
    if (passwd_from_file)
	BZERO(passwd, MAXSECRETLEN);
    /*
     * We've failed to authenticate ourselves to our peer.
     * He'll probably take the link down, and there's not much
     * we can do except wait for that.
     */
}
コード例 #30
0
ファイル: pcr_interface.c プロジェクト: PaulBone/bdwgc
void * GC_DebugAllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear )
{
    if (ptrFree) {
        void * result = (void *)GC_debug_malloc_atomic(size, __FILE__,
                                                             __LINE__);
        if (clear && result != 0) BZERO(result, size);
        return(result);
    } else {
        return((void *)GC_debug_malloc(size, __FILE__, __LINE__));
    }
}