IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

probleme compilation sous debian 64bits


Sujet :

C++

  1. #1
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Mars 2017
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 11
    Par défaut probleme compilation sous debian 64bits
    Bonjour, lors de ma compilation j'obtiens ses warnings :

    res.c: In function ‘get_res’:
    res.c:856:70: warning: passing argument 6 of ‘recvfrom’ from incompatible pointer type
    rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct sockaddr *)&sin, &len);
    ^
    In file included from res.c:11:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:174:16: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
    ^
    gcc -g -O3 -pipe -I../include -c s_auth.c -o s_auth.o
    s_auth.c: In function ‘send_authports’:
    s_auth.c:98:53: warning: passing argument 3 of ‘getsockname’ from incompatible pointer type
    if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) ||
    ^
    In file included from s_auth.c:21:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:127:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
    ^
    s_auth.c:99:55: warning: passing argument 3 of ‘getpeername’ from incompatible pointer type
    getpeername(cptr->fd, (struct sockaddr *)&them, &tlen))
    ^
    In file included from s_auth.c:21:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:141:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
    ^
    gcc -g -O3 -pipe -I../include -c s_bsd.c -o s_bsd.o
    s_bsd.c: In function ‘report_error’:
    s_bsd.c:208:71: warning: passing argument 5 of ‘getsockopt’ from incompatible pointer type
    if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:219:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getsockopt (int __fd, int __level, int __optname,
    ^
    s_bsd.c: In function ‘inetport’:
    s_bsd.c:325:57: warning: passing argument 3 of ‘getsockname’ from incompatible pointer type
    if (getsockname(cptr->fd, (struct sockaddr *)&server, &len))
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:127:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
    ^
    s_bsd.c: In function ‘check_init’:
    s_bsd.c:654:58: warning: passing argument 3 of ‘getpeername’ from incompatible pointer type
    else if (getpeername(cptr->fd, (struct sockaddr *)&sk, &len) == -1)
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:141:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
    ^
    s_bsd.c: In function ‘get_sockerr’:
    s_bsd.c:1193:71: warning: passing argument 5 of ‘getsockopt’ from incompatible pointer type
    if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:219:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getsockopt (int __fd, int __level, int __optname,
    ^
    s_bsd.c: In function ‘add_connection’:
    s_bsd.c:1274:51: warning: passing argument 3 of ‘getpeername’ from incompatible pointer type
    if (getpeername(fd, (struct sockaddr *)&addr, &len) == -1)
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:141:12: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
    ^
    s_bsd.c: In function ‘polludp’:
    s_bsd.c:2517:67: warning: passing argument 6 of ‘recvfrom’ from incompatible pointer type
    n = recvfrom(udpfd, readbuf, mlen, 0, (struct sockaddr *)&from, &fromlen);
    ^
    In file included from s_bsd.c:23:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:174:16: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
    ^
    gcc -g -O3 -pipe -I../include -c s_ping.c -o s_ping.o
    s_ping.c: In function ‘read_ping’:
    s_ping.c:231:40: warning: passing argument 6 of ‘recvfrom’ from incompatible pointer type
    (struct sockaddr *)&remote_addr, &addr_len)) == -1)
    ^
    In file included from s_ping.c:21:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:174:16: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’
    extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
    ^
    gcc -g -O3 -pipe -I../include -c s_user.c -o s_user.o
    s_user.c: In function ‘add_target’:
    s_user.c:2136:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    register u_int tmp = ((u_int)target & 0xffff00) >> 8;
    ^
    s_user.c: In function ‘check_target_limit’:
    s_user.c:2162:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    register u_int tmp = ((u_int)target & 0xffff00) >> 8;
    ^
    s_user.c: In function ‘m_umode’:
    s_user.c:3721:14: warning: character constant too long for its type
    case 'i o o o o':
    ^
    s_user.c:3721:9: warning: case label value exceeds maximum value for type
    case 'i o o o o':
    ^
    s_user.c:3723:14: warning: character constant too long for its type
    case 'i O O O O':
    ^
    s_user.c:3723:9: warning: case label value exceeds maximum value for type
    case 'i O O O O':
    ^
    fonction res.c causant le soucis :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
     
    /*
     * Read a dns reply from the nameserver and process it.
     */
    struct hostent *get_res(char *lp)
    {
      static u_char buf[sizeof(HEADER) + MAXPACKET];
      Reg1 HEADER *hptr;
      Reg2 ResRQ *rptr = NULL;
      aCache *cp = NULL;
      struct sockaddr_in sin;
      int a, max;
      size_t rc, len = sizeof(sin);
     
      alarm(4);
      rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct sockaddr *)&sin, &len);
      alarm(0);
     
      if (rc <= sizeof(HEADER))
        return NULL;
      /*
       * Convert DNS reply reader from Network byte order to CPU byte order.
       */
      hptr = (HEADER *) buf;
      hptr->id = ntohs(hptr->id);
      hptr->ancount = ntohs(hptr->ancount);
      hptr->qdcount = ntohs(hptr->qdcount);
      hptr->nscount = ntohs(hptr->nscount);
      hptr->arcount = ntohs(hptr->arcount);
    #ifdef	DEBUG
      Debug((DEBUG_NOTICE, "get_res:id = %d rcode = %d ancount = %d",
          hptr->id, hptr->rcode, hptr->ancount));
    #endif
      reinfo.re_replies++;
      /*
       * Response for an id which we have already received an answer for
       * just ignore this response.
       */
      if ((rptr = find_id(hptr->id)) == NULL)
      {
        Debug((DEBUG_DNS, "find_id %d failed", hptr->id));
        return NULL;
      }
      /*
       * Check against possibly fake replies
       */
      max = MIN(_res.nscount, rptr->sends);
      if (!max)
        max = 1;
     
      for (a = 0; a < max; a++)
      {
        if (!_res.nsaddr_list[a].sin_addr.s_addr ||
    	!memcmp((char *)&sin.sin_addr, (char *)&_res.nsaddr_list[a].sin_addr,
    	sizeof(struct in_addr)))
          break;
      }
      if (a == max)
      {
        reinfo.re_unkrep++;
        Debug((DEBUG_DNS, "got response from unknown ns"));
        goto getres_err;
      }
     
      if ((hptr->rcode != NOERROR) || (hptr->ancount == 0))
      {
        switch (hptr->rcode)
        {
          case NXDOMAIN:
    	h_errno = TRY_AGAIN;
    	break;
          case SERVFAIL:
    	h_errno = TRY_AGAIN;
    	break;
          case NOERROR:
    	h_errno = NO_DATA;
    	break;
          case FORMERR:
          case NOTIMP:
          case REFUSED:
          default:
    	h_errno = NO_RECOVERY;
    	break;
        }
        reinfo.re_errors++;
        /*
         * If a bad error was returned, we stop here and dont send
         * send any more (no retries granted).
         */
        if (h_errno != TRY_AGAIN)
        {
          Debug((DEBUG_DNS, "Fatal DNS error %d for %d", h_errno, hptr->rcode));
          rptr->resend = 0;
          rptr->retries = 0;
        }
        goto getres_err;
      }
      /* 
       * If this fails we didn't get a buffer to hold the hostent or
       * there was an error decoding the received packet, try it again
       * and hope it works the next time.
       */
      a = proc_answer(rptr, hptr, buf, &buf[rc]);
      Debug((DEBUG_DNS, "get_res:Proc answer = %d", a));
     
      if (a && rptr->type == T_PTR)
      {
        struct hostent *hp2 = NULL;
     
        if (BadPtr(rptr->he.h.h_name))	/* Kludge!      960907/Vesa */
          goto getres_err;
     
        Debug((DEBUG_DNS, "relookup %s <-> %s", rptr->he.h.h_name,
    	inetntoa(*((struct in_addr *)rptr->he.h.h_addr_list[0]))));
        /*
         * Lookup the 'authoritive' name that we were given for the
         * ip#.  By using this call rather than regenerating the
         * type we automatically gain the use of the cache with no
         * extra kludges.
         */
        if ((hp2 = gethost_byname((char *)rptr->he.h.h_name, &rptr->cinfo)))
        {
          if (lp)
    	memcpy(lp, &rptr->cinfo, sizeof(Link));
        }
        /*
         * If name wasn't found, a request has been queued and it will
         * be the last one queued.  This is rather nasty way to keep
         * a host alias with the query. -avalon
         */
        else if (*rptr->he.h.h_aliases)
        {
          if (last->he.buf)
    	RunFree(last->he.buf);
          last->he.buf = rptr->he.buf;
          rptr->he.buf = NULL;
          memcpy(&last->he.h, &rptr->he.h, sizeof(struct hostent));
        }
        rem_request(rptr);
        return hp2;
      }
     
      if (a > 0)
      {
        if (lp)
          memcpy(lp, &rptr->cinfo, sizeof(Link));
        cp = make_cache(rptr);
        Debug((DEBUG_DNS, "get_res:cp=%p rptr=%p (made)", cp, rptr));
        rem_request(rptr);
      }
      else if (!rptr->sent)
        rem_request(rptr);
      return cp ? &cp->he.h : NULL;
     
    getres_err:
      /*
       * Reprocess an error if the nameserver didnt tell us to "TRY_AGAIN".
       */
      if (rptr)
      {
        if (h_errno != TRY_AGAIN)
        {
          /*
           * If we havent tried with the default domain and its
           * set, then give it a try next.
           */
          if (_res.options & RES_DEFNAMES && ++rptr->srch == 0)
          {
    	rptr->retries = _res.retry;
    	rptr->sends = 0;
    	rptr->resend = 1;
    	resend_query(rptr);
          }
          else
    	resend_query(rptr);
        }
        else if (lp)
          memcpy(lp, &rptr->cinfo, sizeof(Link));
      }
      return NULL;
    }

    fonction s_auth.c causant le soucis :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
     
    /*
     * send_authports
     *
     * Send the ident server a query giving "theirport , ourport".
     * The write is only attempted *once* so it is deemed to be a fail if the
     * entire write doesn't write all the data given.  This shouldnt be a
     * problem since the socket should have a write buffer far greater than
     * this message to store it in should problems arise. -avalon
     */
    void send_authports(aClient *cptr)
    {
      struct sockaddr_in us, them;
      char authbuf[32];
      size_t ulen, tlen;
     
      Debug((DEBUG_NOTICE, "write_authports(%p) fd %d authfd %d stat %d",
          cptr, cptr->fd, cptr->authfd, cptr->status));
      tlen = ulen = sizeof(us);
      if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) ||
          getpeername(cptr->fd, (struct sockaddr *)&them, &tlen))
      {
    #ifdef	USE_SYSLOG
        syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m",
    	get_client_name(cptr, FALSE));
    #endif
        goto authsenderr;
      }
     
      sprintf_irc(authbuf, "%u , %u\r\n", (unsigned int)ntohs(them.sin_port),
          (unsigned int)ntohs(us.sin_port));
     
      Debug((DEBUG_SEND, "sending [%s] to auth port %s.113",
          authbuf, inetntoa(them.sin_addr)));
      if (write(cptr->authfd, authbuf, strlen(authbuf)) != (int)strlen(authbuf))
      {
      authsenderr:
        ircstp->is_abad++;
        close(cptr->authfd);
        if (cptr->authfd == highest_fd)
          while (!loc_clients[highest_fd])
    	highest_fd--;
        cptr->authfd = -1;
        cptr->flags &= ~FLAGS_AUTH;
     
        if (IsUserPort(cptr))
        {
          sprintf_irc(sendbuf, IDENT_FAIL, me.name);
          write(cptr->fd, sendbuf, strlen(sendbuf));
        }
     
    #ifdef PROXY_PROTECTION
        if (!DoingDNS(cptr) && !DoingSocks(cptr))
    #else
        if (!DoingDNS(cptr))
    #endif /* PROXY_PROTECTION */
          SetAccess(cptr);
      }
      cptr->flags &= ~FLAGS_WRAUTH;
      return;
    }
    fonction s_bsd.c causant le soucis :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
     
    /* Correspond 208 /!\
     * report_error
     *
     * This a replacement for perror(). Record error to log and
     * also send a copy to all *LOCAL* opers online.
     *
     * text    is a *format* string for outputting error. It must
     *         contain only two '%s', the first will be replaced
     *         by the sockhost from the cptr, and the latter will
     *         be taken from sys_errlist[errno].
     *
     * cptr    if not NULL, is the *LOCAL* client associated with
     *         the error.
     */
    void report_error(char *text, aClient *cptr)
    {
      Reg1 int errtmp = errno;	/* debug may change 'errno' */
      Reg2 char *host;
      int err;
      size_t len = sizeof(err);
     
      host = (cptr) ? get_client_name(cptr, FALSE) : "";
     
      Debug((DEBUG_ERROR, text, host, strerror(errtmp)));
     
      /*
       * Get the *real* error from the socket (well try to anyway..).
       * This may only work when SO_DEBUG is enabled but its worth the
       * gamble anyway.
       */
    #if defined(SO_ERROR) && !defined(SOL2)
      if (cptr && !IsMe(cptr) && cptr->fd >= 0)
        if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
          if (err)
    	errtmp = err;
    #endif
      sendto_ops(text, host, strerror(errtmp));
    #ifdef USE_SYSLOG
      syslog(LOG_WARNING, text, host, strerror(errtmp));
    #endif
      if (!running_in_background)
      {
        fprintf(stderr, text, host, strerror(errtmp));
        fprintf(stderr, "\n");
        fflush(stderr);
      }
      return;
    }
     
    /* Correspond 325 /!\
     * inetport
     *
     * Create a socket in the AF_INET domain, bind it to the port given in
     * 'port' and listen to it.  Connections are accepted to this socket
     * depending on the IP# mask given by 'name'.  Returns the fd of the
     * socket created or -1 on error.
     */
    int inetport(aClient *cptr, char *name, unsigned short int port)
    {
      static struct sockaddr_in server;
      int ad[4], opt;
      size_t len = sizeof(server);
      char ipname[20];
     
      ad[0] = ad[1] = ad[2] = ad[3] = 0;
     
      /*
       * do it this way because building ip# from separate values for each
       * byte requires endian knowledge or some nasty messing. Also means
       * easy conversion of "*" 0.0.0.0 or 134.* to 134.0.0.0 :-)
       */
      sscanf(name, "%d.%d.%d.%d", &ad[0], &ad[1], &ad[2], &ad[3]);
      sprintf_irc(ipname, "%d.%d.%d.%d", ad[0], ad[1], ad[2], ad[3]);
     
      if (cptr != &me)
      {
        sprintf(cptr->sockhost, "%-.42s.%u", name, port);
        strcpy(cptr->name, me.name);
      }
      /*
       * At first, open a new socket
       */
      if (cptr->fd == -1)
      {
        alarm(2);
        cptr->fd = socket(AF_INET, SOCK_STREAM, 0);
        alarm(0);
        if (cptr->fd < 0 && errno == EAGAIN)
        {
          sendto_ops("opening stream socket %s: No more sockets",
    	  get_client_name(cptr, TRUE));
          return -1;
        }
      }
      if (cptr->fd < 0)
      {
        report_error("opening stream socket %s: %s", cptr);
        return -1;
      }
      else if (cptr->fd >= MAXCLIENTS)
      {
        sendto_ops("No more connections allowed (%s)", cptr->name);
        close(cptr->fd);
        return -1;
      }
     
      opt = 1;
      setsockopt(cptr->fd, SOL_SOCKET, SO_REUSEADDR,
          (OPT_TYPE *)&opt, sizeof(opt));
     
      /*
       * Bind a port to listen for new connections if port is non-null,
       * else assume it is already open and try get something from it.
       */
      if (port)
      {
        server.sin_family = AF_INET;
    #ifndef VIRTUAL_HOST
        server.sin_addr.s_addr = INADDR_ANY;
    #else
        if (vserv.sin_addr.s_addr == 0)	/* Not already initialised ? */
        {
          struct hostent *hep;
          memset(&vserv, 0, sizeof(vserv));
          vserv.sin_family = AF_INET;
          hep = gethostbyname(me.name);	/* Use name from M: line */
          if (hep && hep->h_addrtype == AF_INET && hep->h_addr_list[0] &&
    	  !hep->h_addr_list[1])
    	memcpy(&vserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
          else
          {
    	report_error("Error creating virtual host %s: %s", cptr);
    	return -1;
          }
        }
        server.sin_addr = vserv.sin_addr;
    #endif
    #ifdef TESTNET
        server.sin_port = htons(port + 10000);
    #else
        server.sin_port = htons(port);
    #endif
        if (bind(cptr->fd, (struct sockaddr *)&server, sizeof(server)) == -1)
        {
          report_error("binding stream socket %s: %s", cptr);
          close(cptr->fd);
          return -1;
        }
      }
      if (getsockname(cptr->fd, (struct sockaddr *)&server, &len))
      {
        report_error("getsockname failed for %s: %s", cptr);
        close(cptr->fd);
        return -1;
      }
     
      if (cptr == &me)		/* KLUDGE to get it work... */
      {
        char buf[1024];
     
    #ifdef TESTNET
        sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*",
    	ntohs(server.sin_port) - 10000);
    #else
        sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*",
    	ntohs(server.sin_port));
    #endif
        write(1, buf, strlen(buf));
      }
      if (cptr->fd > highest_fd)
        highest_fd = cptr->fd;
      cptr->ip.s_addr = inet_addr(ipname);
    #ifdef TESTNET
      cptr->port = ntohs(server.sin_port) - 10000;
    #else
      cptr->port = ntohs(server.sin_port);
    #endif
      listen(cptr->fd, 128);	/* Use listen port backlog of 128 */
      loc_clients[cptr->fd] = cptr;
     
      return 0;
    }
     
    /* Correspond 654 /!\
     * Initialize the various name strings used to store hostnames. This is set
     * from either the server's sockhost (if client fd is a tty or localhost)
     * or from the ip# converted into a string. 0 = success, -1 = fail.
     */
    static int check_init(aClient *cptr, char *sockn)
    {
      struct sockaddr_in sk;
      size_t len = sizeof(struct sockaddr_in);
      sockn[HOSTLEN] = 0;
     
    #ifdef	UNIXPORT
      if (IsUnixSocket(cptr))
      {
        strncpy(sockn, cptr->acpt->sockhost, HOSTLEN);
        get_sockhost(cptr, sockn);
        return 0;
      }
    #endif
     
      /* If descriptor is a tty, special checking... */
      if (isatty(cptr->fd))
      {
        strncpy(sockn, me.sockhost, HOSTLEN);
        memset(&sk, 0, sizeof(struct sockaddr_in));
      }
      else if (getpeername(cptr->fd, (struct sockaddr *)&sk, &len) == -1)
      {
        report_error("connect failure: %s %s", cptr);
        return -1;
      }
      strcpy(sockn, inetntoa(sk.sin_addr));
      if (inet_netof(sk.sin_addr) == IN_LOOPBACKNET)
      {
        cptr->hostp = NULL;
        strncpy(sockn, me.sockhost, HOSTLEN);
      }
      memcpy(&cptr->ip, &sk.sin_addr, sizeof(struct in_addr));
    #ifdef TESTNET
      cptr->port = ntohs(sk.sin_port) - 10000;
    #else
      cptr->port = ntohs(sk.sin_port);
    #endif
     
      return 0;
    }
     
    /* Correspond 1193 */
     
    int get_sockerr(aClient *cptr)
    {
      int errtmp = errno, err = 0;
      size_t len = sizeof(err);
    #if defined(SO_ERROR) && !defined(SOL2)
      if (cptr->fd >= 0)
        if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
          if (err)
    	errtmp = err;
    #endif
      return errtmp;
    }
     
    /* Correspond 1274 /!\
     * Creates a client which has just connected to us on the given fd.
     * The sockhost field is initialized with the ip# of the host.
     * The client is added to the linked list of clients but isnt added to any
     * hash tables yet since it doesn't have a name.
     */
    aClient *add_connection(aClient *cptr, int fd, int type)
    {
      Link lin;
      aClient *acptr;
      aConfItem *aconf = NULL;
      acptr = make_client(NULL, (cptr->port == server_port) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER);
     
      if (cptr != &me)
        aconf = cptr->confs->value.aconf;
      /*
       * Removed preliminary access check. Full check is performed in
       * m_server and m_user instead. Also connection time out help to
       * get rid of unwanted connections.
       */
      if (type == ADCON_TTY)	/* If descriptor is a tty,
    				   special checking... */
        get_sockhost(acptr, cptr->sockhost);
      else
      {
        Reg1 char *s, *t;
        struct sockaddr_in addr;
        size_t len = sizeof(struct sockaddr_in);
     
        if (getpeername(fd, (struct sockaddr *)&addr, &len) == -1)
        {
          report_error("Failed in connecting to %s: %s", cptr);
        add_con_refuse:
          ircstp->is_ref++;
          acptr->fd = -2;
          free_client(acptr);
          close(fd);
          return NULL;
        }
        /* Don't want to add "Failed in connecting to" here.. */
        if (aconf && IsIllegal(aconf))
          goto add_con_refuse;
        /*
         * Copy ascii address to 'sockhost' just in case. Then we
         * have something valid to put into error messages...
         */
        get_sockhost(acptr, inetntoa(addr.sin_addr));
        memcpy(&acptr->ip, &addr.sin_addr, sizeof(struct in_addr));
    #ifdef TESTNET
        acptr->port = ntohs(addr.sin_port) - 10000;
    #else
        acptr->port = ntohs(addr.sin_port);
    #endif
     
        /*
         * Check that this socket (client) is allowed to accept
         * connections from this IP#.
         */
        for (s = (char *)&cptr->ip, t = (char *)&acptr->ip, len = 4;
    	len > 0; len--, s++, t++)
        {
          if (!*s)
    	continue;
          if (*s != *t)
    	break;
        }
     
        if (len)
          goto add_con_refuse;
     
        lin.flags = ASYNC_CLIENT;
        lin.value.cptr = acptr;
    #ifdef NODNS
        if (!strcmp("127.0.0.1", inetntoa(addr.sin_addr)))
        {
          static struct hostent lhe = {"localhost", NULL, 0, 0, NULL};
          acptr->hostp = &lhe;
          if (!DoingAuth(acptr))
    	SetAccess(acptr);
        }
        else
        {
    #endif
          Debug((DEBUG_DNS, "lookup %s", inetntoa(addr.sin_addr)));
          acptr->hostp = gethost_byaddr(&acptr->ip, &lin);
          if (!acptr->hostp)
    	SetDNS(acptr);
          nextdnscheck = 1;
    #ifdef NODNS
        }
    #endif
      }
     
      if (aconf)
        aconf->clients++;
      acptr->fd = fd;
      if (fd > highest_fd)
        highest_fd = fd;
      loc_clients[fd] = acptr;
      acptr->acpt = cptr;
      Count_newunknown(nrof);
      add_client_to_list(acptr);
      set_non_blocking(acptr->fd, acptr);
      set_sock_opts(acptr->fd, acptr);
     
      /*
       * Add this local client to the IPcheck registry.
       * If it is a connection to a user port and if the site has been throttled,
       * reject the user.
       */
      if (IPcheck_local_connect(acptr) == -1 && IsUserPort(acptr))
      {
        ircstp->is_ref++;
    exit_client(cptr, acptr, &me,
    	"Your host is trying to (re)connect too fast -- throttled");
        return NULL;
      }
     
      start_auth(acptr);
      return acptr;
    }
     
    /* Correspond 2516 /!\
     * max # of pings set to 15/sec.
     */
    static void polludp(void)
    {
      Reg1 char *s;
      struct sockaddr_in from;
      int n;
      size_t fromlen = sizeof(from);
      static time_t last = 0;
      static int cnt = 0, mlen = 0;
     
      /*
       * find max length of data area of packet.
       */
      if (!mlen)
      {
        mlen = sizeof(readbuf) - strlen(me.name) - strlen(version);
        mlen -= 6;
        if (mlen < 0)
          mlen = 0;
      }
      Debug((DEBUG_DEBUG, "udp poll"));
     
      n = recvfrom(udpfd, readbuf, mlen, 0, (struct sockaddr *)&from, &fromlen);
      if (now == last)
        if (++cnt > 14)
          return;
      cnt = 0;
      last = now;
     
      if (n == -1)
      {
        if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
          return;
        else
        {
          report_error("udp port recvfrom (%s): %s", &me);
          return;
        }
      }
      ircstp->is_udp++;
      if (n < 19)
        return;
     
      s = readbuf + n;
      /*
       * attach my name and version for the reply
       */
      *readbuf |= 1;
      strcpy(s, me.name);
      s += strlen(s) + 1;
      strcpy(s, version);
      s += strlen(s);
      sendto(udpfd, readbuf, s - readbuf, 0,
          (struct sockaddr *)&from, sizeof(from));
      return;
    }
    fonction s_ping.c causant le soucis :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
     
    /*
     * read_ping
     */
    void read_ping(aClient *cptr)
    {
      size_t addr_len = sizeof(struct sockaddr_in);
      struct sockaddr_in remote_addr;
      struct timeval tv;
      int len;
      unsigned long int pingtime;
      char *s;
     
      memcpy(&remote_addr.sin_addr, &cptr->ip, sizeof(struct in_addr));
    #ifdef TESTNET
      remote_addr.sin_port = htons(cptr->port + 10000);
    #else
      remote_addr.sin_port = htons(cptr->port);
    #endif
      remote_addr.sin_family = AF_INET;
     
      gettimeofday(&tv, NULL);
     
      if ((len = recvfrom(cptr->fd, (char *)cptr->confs, UPINGBUFSIZE, 0,
          (struct sockaddr *)&remote_addr, &addr_len)) == -1)
      {
        int err = errno;
        if (MyUser(cptr->acpt)
    #ifndef NO_PROTOCOL9
    	|| (IsServer(cptr->acpt->from) && Protocol(cptr->acpt->from) < 10)
    #endif
    	)
          sendto_one(cptr->acpt, ":%s NOTICE %s :UPING: recvfrom: %s",
    	  me.name, cptr->acpt->name, strerror(get_sockerr(cptr)));
        else
          sendto_one(cptr->acpt, "%c NOTICE %c%c%c :UPING: recvfrom: %s",
    	  NumServ(&me), NumNick(cptr->acpt), strerror(get_sockerr(cptr)));
        Debug((DEBUG_SEND, "read_ping: recvfrom: %d", err));
        if (err != EAGAIN)
          end_ping(cptr);
        return;
      }
     
      if (len < 19)
        return;			/* Broken packet */
     
      pingtime = (tv.tv_sec - atoi((char *)cptr->confs + 1)) * 1000 +
          (tv.tv_usec - atoi((char *)cptr->confs + strlen((char *)cptr->confs) +
          1)) / 1000;
      cptr->sendM += pingtime;
      if (!(cptr->receiveK) || (cptr->receiveK > pingtime))
        cptr->receiveK = pingtime;
      if (pingtime > cptr->receiveM)
        cptr->receiveM = pingtime;
      /* Wait at most 10 times the average pingtime for the next one: */
      if ((cptr->since =
          cptr->sendM / (100 * (cptr->hopcount - cptr->receiveB + 1))) < 2)
        cptr->since = 2;
      cptr->firsttime = tv.tv_sec + cptr->since;
     
      Debug((DEBUG_SEND, "read_ping: %d bytes, ti %lu: [%s %s] %lu ms",
          len, cptr->since, (char *)cptr->confs,
          (char *)cptr->confs + strlen((char *)cptr->confs) + 1, pingtime));
     
      s = cptr->buffer + strlen(cptr->buffer);
      sprintf(s, " %lu", pingtime);
     
      if ((--(cptr->receiveB) <= 0 && !DoPing(cptr)) || !(cptr->acpt))
        end_ping(cptr);
     
      return;
    }
    fonction s_user.c causant le soucis :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
     
    /*
     * add_target
     *
     * sptr must be a local client!
     *
     * Cannonifies target for client `sptr'.
     */
    void add_target(aClient *sptr, void *target)
    {
      register u_char *p;
      register u_int tmp = ((u_int)target & 0xffff00) >> 8;
      u_char hash = (tmp * tmp) >> 12;
      if (sptr->targets[0] == hash)	/* Last person that we messaged ourself? */
        return;
      for (p = sptr->targets; p < &sptr->targets[MAXTARGETS - 1];)
        if (*++p == hash)
          return;			/* Already in table */
     
      /* New target */
      memmove(&sptr->targets[RESERVEDTARGETS + 1],
          &sptr->targets[RESERVEDTARGETS], MAXTARGETS - RESERVEDTARGETS - 1);
      sptr->targets[RESERVEDTARGETS] = hash;
      return;
    }
     
    /*
     * check_target_limit
     *
     * sptr must be a local client !
     *
     * Returns 'true' (1) when too many targets are addressed.
     * Returns 'false' (0) when it's ok to send to this target.
     */
    int check_target_limit(aClient *sptr, void *target, const char *name, int created)
    {
      register u_char *p;
      register u_int tmp = ((u_int)target & 0xffff00) >> 8;
      u_char hash = (tmp * tmp) >> 12;
     
    /* NiX */
      return 0;
    /* end NiX */
     
    #ifdef CS_NO_FLOOD_ESNET
      if(IsChannelService(sptr)) return 0;
      if(IsOper(sptr)) return 0;
    #endif
     
      if (sptr->targets[0] == hash)	/* Same target as last time ? */
        return 0;
      for (p = sptr->targets; p < &sptr->targets[MAXTARGETS - 1];)
        if (*++p == hash)
        {
          memmove(&sptr->targets[1], &sptr->targets[0], p - sptr->targets);
          sptr->targets[0] = hash;
          return 0;
        }
     
      /* New target */
      if (!created)
      {
        if (now < sptr->nexttarget)
        {
          if (sptr->nexttarget - now < TARGET_DELAY + 8)	/* No server flooding */
          {
    	sptr->nexttarget += 2;
    	sendto_one(sptr, err_str(ERR_TARGETTOOFAST),
    	    me.name, sptr->name, name, sptr->nexttarget - now);
          }
          return 1;
        }
        else
        {
    #ifdef GODMODE
          sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft %lu",
    	  me.name, sptr->name, name, (now - sptr->nexttarget) / TARGET_DELAY);
    #endif
          sptr->nexttarget += TARGET_DELAY;
          if (sptr->nexttarget < now - (TARGET_DELAY * (MAXTARGETS - 1)))
    	sptr->nexttarget = now - (TARGET_DELAY * (MAXTARGETS - 1));
        }
      }
      memmove(&sptr->targets[1], &sptr->targets[0], MAXTARGETS - 1);
      sptr->targets[0] = hash;
      return 0;
    }
     
    /* Correspond au warning i o o o o /!\
     
    /*
     * m_umode() added 15/10/91 By Darren Reed.
     *
     * parv[0] - sender
     * parv[1] - username to change mode for
     * parv[2] - modes to change
     */
    int m_umode(aClient *cptr, aClient *sptr, int parc, char *parv[])
    {
      Reg1 int flag;
      Reg2 int *s;
      Reg3 char **p, *m;
      aClient *acptr;
      int what, setflags;
      snomask_t tmpmask = 0;
      int snomask_given = 0;
     
      what = MODE_ADD;
      if (parc < 2)
      {
        sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "MODE");
        return 0;
      }
     
      if (!(acptr = FindUser(parv[1])))
      {
        if (MyConnect(sptr))
          sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), me.name, parv[0], parv[1]);
        return 0;
      }
     
      if (IsServer(sptr) || sptr != acptr)
      {
        if (IsServer(cptr))
          sendto_ops_butone(NULL, &me, ":%s WALLOPS :MODE for User %s From %s!%s",
    	  me.name, parv[1], get_client_name(cptr, FALSE), sptr->name);
        else
          sendto_one(sptr, err_str(ERR_USERSDONTMATCH), me.name, parv[0]);
        return 0;
      }
      if (parc < 3)
      {
        m = buf;
        *m++ = '+';
        for (s = user_modes; (flag = *s) && (m - buf < BUFSIZE - 4); s += 2)
          if (sptr->flags & flag)
    	*m++ = (char)(*(s + 1));
        *m = '\0';
        sendto_one(sptr, rpl_str(RPL_UMODEIS), me.name, parv[0], buf);
        if ((sptr->flags & FLAGS_SERVNOTICE) && MyConnect(sptr)
    	&& sptr->snomask != (unsigned int)(IsOper(sptr) ? SNO_OPERDEFAULT : SNO_DEFAULT))
          sendto_one(sptr, rpl_str(RPL_SNOMASK), me.name, parv[0],
    	  sptr->snomask, sptr->snomask);
        return 0;
      }
     
      /* find flags already set for user */
      setflags = 0;
      for (s = user_modes; (flag = *s); s += 2)
        if (sptr->flags & flag)
          setflags |= flag;
      if (MyConnect(sptr))
        tmpmask = sptr->snomask;
     
      /*
       * parse mode change string(s)
       */
      for (p = &parv[2]; *p; p++)	/* p is changed in loop too */
        for (m = *p; *m; m++)
          switch (*m)
          {
    	case '+':
    	  what = MODE_ADD;
    	  break;
    	case '-':
    	  what = MODE_DEL;
    	  break;
    	case 's':
    	if ((what == MODE_ADD) && !IsOper(sptr))
    	break;
     
    	  if (*(p + 1) && is_snomask(*(p + 1)))
    	  {
    	    snomask_given = 1;
    	    tmpmask = umode_make_snomask(tmpmask, *++p, what);
    	    tmpmask &= (IsAnOper(sptr) ? SNO_ALL : SNO_USER);
    	  }
    	  else
    	    tmpmask = (what == MODE_ADD) ?
    		(IsAnOper(sptr) ? SNO_OPERDEFAULT : SNO_DEFAULT) : 0;
    	  if (tmpmask)
    	    sptr->flags |= FLAGS_SERVNOTICE;
    	  else
    	    sptr->flags &= ~FLAGS_SERVNOTICE;
    	  break;
     
    /* NiX hp */
     
        case 'x':
          if (what == MODE_ADD) {
     
          sptr->user->prot=1;
          sptr->flags |= UMODE_PROTECT; }
          else
                {
    	            if (IsPrivileged(sptr))
    	            {
    		            sptr->user->prot=0;
    		            sptr->flags &= ~UMODE_PROTECT;
    		            if(MyUser(sptr))
    		            sendto_one(sptr, "NOTICE %s :Vous avez desactivé votre protection de l'host (-x).", parv[0]);
    	            }
                }
          break;
     
    /* NiX hp */
    	  /*
    	   * We may not get these, but they shouldnt be in default:
    	   */
    	case ' ':
     
    /* Fix Faille +r -r */
            case 'r':
    		if (what == MODE_ADD) {
                    if (IsNickReg(sptr) || IsChannelService(sptr)) {
    		sptr->flags |= FLAGS_NICKREG;
    		} else {
    		sptr->flags &= ~FLAGS_NICKREG;
    		}
    		} else {
    		if (IsNickReg(sptr)) {
    		sptr->flags |= FLAGS_NICKREG;
    		}
    		}
            case 'S':
    		if (what == MODE_ADD) {
    		}
    		else {
    		if (IsShun(sptr)) {
    		sptr->flags |= FLAGS_SHUN;
    		}
    		}
    /* Fix Faille sendto_ops */
            case 'i o o o o':
    	break;
            case 'i O O O O':
    	  break;
    	case '\n':
    	case '\r':
    	case '\t':
    	  break;
    	default:
    	  for (s = user_modes; (flag = *s); s += 2)
    	    if (*m == (char)(*(s + 1)))
    	    {
    	      if (what == MODE_ADD)
    		sptr->flags |= flag;
    	      else if ((flag & (FLAGS_OPER | FLAGS_LOCOP)))
    	      {
    		sptr->flags &= ~(FLAGS_OPER | FLAGS_LOCOP);
    		if (MyConnect(sptr))
    		  tmpmask = sptr->snomask & ~SNO_OPER;
    	      }
    	      /* allow either -o or -O to reset all operator status's... */
    	      else
    		sptr->flags &= ~flag;
    	      break;
    	    }
    	  if (flag == 0 && MyConnect(sptr))
    	    sendto_one(sptr, err_str(ERR_UMODEUNKNOWNFLAG), me.name, parv[0]);
    	  break;
          }
     
    /* remove des +oaA lors du rejet d'un des modes - StyX */
     if ((setflags & FLAGS_LOCADMIN) && !IsLocAdmin(sptr) && !IsServer(cptr)) { ClearGlobAdmin(sptr); ClearOper(sptr); }
     if ((setflags & FLAGS_GLOBADMIN) && !IsGlobAdmin(sptr) && !IsServer(cptr)) { ClearLocAdmin(sptr); ClearOper(sptr); }
     if ((setflags & FLAGS_OPER) && !IsOper(sptr) && !IsServer(cptr)) { ClearGlobAdmin(sptr); ClearLocAdmin(sptr); }
     
    /* on empŽche les /mode +oaA - StyX */
     if (!(setflags & FLAGS_GLOBADMIN) && IsGlobAdmin(sptr) && !IsServer(cptr)) { ClearGlobAdmin(sptr); }
     if (!(setflags & FLAGS_LOCADMIN) && IsLocAdmin(sptr) && !IsServer(cptr)) { ClearLocAdmin(sptr); }
     if (!(setflags & FLAGS_OPER) && IsOper(sptr) && !IsServer(cptr)) { ClearOper(sptr); }
     if (!(setflags & FLAGS_ADMIN) && IsAdmin(sptr) && !IsAnOper(cptr)) { ClearAdmin(sptr); }
     if (!(setflags & FLAGS_SHUN) && IsShun(sptr) && !IsAnOper(cptr)) { ClearShun(sptr); }
     
    /* on empŽche les /mode +wsg si non-oper - StyX */
     if (!(setflags & FLAGS_WALLOP) && !IsOper(sptr) && !IsServer(cptr)) { sptr->flags &= ~FLAGS_WALLOP; }
     if (!(setflags & FLAGS_DEBUG) && !IsOper(sptr) && !IsServer(cptr)) { sptr->flags &= ~FLAGS_DEBUG; }
     if (!(setflags & FLAGS_SERVNOTICE) && !IsOper(sptr) && !IsServer(cptr)) { sptr->flags &= ~FLAGS_SERVNOTICE; }
     if (!(setflags & FLAGS_ADMIN) && !IsOper(sptr) && !IsServer(cptr)) { sptr->flags &= ~FLAGS_ADMIN; }
     if (!(setflags & FLAGS_SHUN) && !IsOper(sptr) && !IsServer(cptr)) { sptr->flags &= ~FLAGS_SHUN; }
     
      if (!(setflags & FLAGS_LOCOP) && IsLocOp(sptr) && !IsServer(cptr))
        sptr->flags &= ~FLAGS_LOCOP;
      if ((setflags & (FLAGS_OPER | FLAGS_LOCOP)) && !IsAnOper(sptr) &&
          MyConnect(sptr))
        det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPS);
      /* new umode; servers can set it, local users cannot;
       * prevents users from /kick'ing or /mode -o'ing */
     
    /*
    ** Si somos IRCOPs y hemos puesto el flag K, lo acepta.
    ** jcea@argo.es - 16/Dic/97
    */
      if (!(setflags & FLAGS_CHSERV) && !IsServer(cptr)
    #ifdef OPER_CHANNEL_SERVICE_ESNET
        && !IsOper(sptr)
    #endif
        )
        sptr->flags &= ~FLAGS_CHSERV;
     
     
      /*
       * Compare new flags with old flags and send string which
       * will cause servers to update correctly.
       */
      if ((setflags & FLAGS_OPER) && !IsOper(sptr))
        --nrof.opers;
      if (!(setflags & FLAGS_OPER) && IsOper(sptr))
        ++nrof.opers;
      if ((setflags & FLAGS_ADMIN) && !IsAdmin(sptr))
        --nrof.opers;
      if (!(setflags & FLAGS_ADMIN) && IsAdmin(sptr))
        ++nrof.opers;
      if ((setflags & FLAGS_INVISIBLE) && !IsInvisible(sptr))
        --nrof.inv_clients;
      if (!(setflags & FLAGS_INVISIBLE) && IsInvisible(sptr))
        ++nrof.inv_clients;
      send_umode_out(cptr, sptr, setflags);
     
      if (MyConnect(sptr))
      {
        if (tmpmask != sptr->snomask)
          set_snomask(sptr, tmpmask, SNO_SET);
        if (sptr->snomask && snomask_given)
          sendto_one(sptr, rpl_str(RPL_SNOMASK), me.name, sptr->name,
    	  sptr->snomask, sptr->snomask);
      }
      return 0;
    }
    Cela fait maintenant 72H que je cherche sans trouver merci d'avance a l'ame charitable qui me viendras en aide ( fonctionne sous 32bits - ces erreurs surviene sur une plateforme 64bits.).

  2. #2
    Expert confirmé

    Avatar de fearyourself
    Homme Profil pro
    Ingénieur Informaticien Senior
    Inscrit en
    Décembre 2005
    Messages
    5 121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur Informaticien Senior
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2005
    Messages : 5 121
    Par défaut
    Les messages sont clairs non?

    - Tu utilises le mauvais pointeur pour certains cas
    - Tu ne peux pas faire 'i o o o o' pour un case
    - Tu dois faire ton arithmétique sur les pointeurs maintenant avec 64 bits...

    A mon avis tu auras d'autres soucis après avoir résolu ceux-là
    Jc

  3. #3
    Expert éminent
    Avatar de koala01
    Homme Profil pro
    aucun
    Inscrit en
    Octobre 2004
    Messages
    11 635
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : Belgique

    Informations professionnelles :
    Activité : aucun

    Informations forums :
    Inscription : Octobre 2004
    Messages : 11 635
    Par défaut
    Salut,

    De manière générale, les avertissements te signalent que tu transmet un pointeur sur une valeur de type size_t (typiquement, on peut considérer qu'il s'agit d'un unsigned long) alors que la fonction s'attend à recevoir un pointeur sur un élément de type socklen_t.

    Il faudrait donc essayer de vérifier quel type de donnée est associé à socklen_t, car il se peut que ce soit un simple /* unsigned */ int ou un... /* unsigned*/ long long. Il y aurait donc deux solutions possibles : soit, tu risque une "perte de données" (un int, signé ou non ne permet que la représentation d'un intervalle de valeur bien plus petit qu'un long), soit tu n'arriveras jamais à utiliser toutes les "valeurs représentables" par un socklen_t, ce qui -- en définitive -- s'avèrerait être "le moindre mal"

    Dans le cas présent, si ton code compile en mode 32 bits sans avertissement mais pas en mode 64 bits, j'aurais sans doute tendance à pencher pour le le fait que (pour une raison ou une autre) tu utilises les en-tête spécifiques au mode 32 lors de ta tentative de compilation en mode 32 bits; du moins, en ce qui concerne l'alias de type socklen_t.

    Aussi bizare que cela puisse paraitre, je ne serais pas étonné s'il y avait un symbole préprocesseur susceptible d'être défini afin de corriger le problème. Quelque chose (à dénicher dans le fichier d'en-tête) qui pourrait ressembler à
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    #if defined(USE_32BITS) // c'est peut être pas ce symbole là, précisément 
        typedef socklent_t  unsigned int;
    #if defined(USE_64BITS)
        typedef socklen_t unsingend long; // c'est peut être pas ce symbole là non plus
    #endif
    Tout ce que tu aurais donc à faire afin de corriger le problème serait d'ajouter un -DLE_SYMBOLE_VOULU_POUR_64BITS à tes options de compilation afin de corriger le problème

    Ceci étant dit, il faut savoir que les socket "linux" et les sockets "windows" fonctionnent différemment, et que leur utilisation peut imposer de lourdes restrictions en termes de portabilité. Ainsi, si tu en venais un jour à décider de porter ton application sous windows, tu te trouverais sans doute face à l'obligation de truffer ton code de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    #ifdefined (__WIN32)
        /* code spécifique à windows */
    #elif defined(LINUX)
       /* code spécifique à linux
    #endif
    (bon, d'accord, il y a d'autres possibilités, et celle-ci est sans doute la plus vilaine de toutes )

    De plus, il faut savoir que les bibliothèques issues du C posent un tas de problème à l'utilisation en C++, non pas parce qu'elles sont "incompatibles", mais "simplement" parce que C et C++ sont devenus des langages totalement différents avec le temps, ce qui occasionne certains "point de friction" entre les langages.

    Par chance, il existe des bibliothèques (écrites en C++) qui offrent une réponse correcte à tous les problèmes que je viens de citer, dont, entre autres, boost::asio, dont l'utilisation pourrait t'éviter bien des cheveux blancs.
    A méditer: La solution la plus simple est toujours la moins compliquée
    Ce qui se conçoit bien s'énonce clairement, et les mots pour le dire vous viennent aisément. Nicolas Boileau
    Compiler Gcc sous windows avec MinGW
    Coder efficacement en C++ : dans les bacs le 17 février 2014
    mon tout nouveau blog

  4. #4
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Mars 2017
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 11
    Par défaut
    Citation Envoyé par fearyourself Voir le message
    Les messages sont clairs non?

    - Tu utilises le mauvais pointeur pour certains cas
    - Tu ne peux pas faire 'i o o o o' pour un case
    - Tu dois faire ton arithmétique sur les pointeurs maintenant avec 64 bits...

    A mon avis tu auras d'autres soucis après avoir résolu ceux-là
    Jc
    merci effectivement je n'ai plus aucuns warnings mais :
    (gdb) run -t -h *hostname*
    Starting program: /home/ircd/ircd/ircd -t -h *hostname*
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [New Thread 0x7ffff5e2e700 (LWP 4847)]
    [Thread 0x7ffff5e2e700 (LWP 4847) exited]

    Program received signal SIGSEGV, Segmentation fault.
    vsprintf_irc (str=0x75b2e3 <sendbuf+35> "#Accueil\r\n", format=0x4407cb "",
    format@entry=0x4407c2 " JOIN :%s", vl=0x7fffffffdf48) at sprintf_irc.c:291
    291 if ((*str = *p1))
    (gdb) bt
    #0 vsprintf_irc (str=0x75b2e3 <sendbuf+35> "#Accueil\r\n",
    format=0x4407cb "", format@entry=0x4407c2 " JOIN :%s", vl=0x7fffffffdf48)
    at sprintf_irc.c:291
    #1 0x0000000000439f30 in vsendto_prefix_one (to=0x772c40, from=0x78d3a0,
    pattern=0x4407bf ":%s JOIN :%s", vl=<optimized out>) at send.c:324
    #2 0x000000000043a258 in sendto_channel_butserv (chptr=<optimized out>,
    from=0x78d3a0, pattern=0x4407bf ":%s JOIN :%s") at send.c:571
    #3 0x000000000040dfcd in m_join (cptr=0x7fffffffdf48, sptr=0x78d3a0, parc=2,
    parv=0x0) at channel.c:2510
    #4 0x0000000000430e78 in register_user (cptr=0x78d3a0, sptr=0x78d3a0,
    nick=0x7fffffffe030 "\300\356h", username=0x0) at s_user.c:863
    #5 0x000000000041841b in dopacket (cptr=0x78d3a0, buffer=<optimized out>,
    length=0) at packet.c:104
    #6 0x00000000004209e0 in read_packet (rfd=<optimized out>,
    cptr=<optimized out>) at s_bsd.c:1605
    #7 read_message (delay=140737488346952) at s_bsd.c:1959
    #8 0x0000000000402d08 in main (argc=<optimized out>, argv=<optimized out>)
    at ircd.c:981

  5. #5
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Mars 2017
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 11
    Par défaut
    Citation Envoyé par koala01 Voir le message
    ...
    Merci de tes explication mon soucis de warning est résolue mais demeure un bug lors de plus de 1 utilisateur le serveur saute. :/ dans mon message plus haut mon résultat GDB

  6. #6
    Expert confirmé

    Avatar de fearyourself
    Homme Profil pro
    Ingénieur Informaticien Senior
    Inscrit en
    Décembre 2005
    Messages
    5 121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur Informaticien Senior
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2005
    Messages : 5 121
    Par défaut
    Problème de pointeurs à mon avis. Vu que tu avais de l'arithmétique sur les pointeurs, je pense que c'est mal fait ;-)
    Jc

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème de démarrage(boot)sur un noyau 2.6.25 compilé sous Debian Lenny 5
    Par oruchi-embedded dans le forum Administration système
    Réponses: 4
    Dernier message: 19/12/2010, 09h54
  2. probleme compilation sous AIX
    Par s_cherbani dans le forum AIX
    Réponses: 2
    Dernier message: 03/11/2010, 15h36
  3. Cross compilation sous Debian
    Par willycat dans le forum Autres éditeurs
    Réponses: 0
    Dernier message: 25/06/2008, 11h08
  4. Probleme résolution sous Debian avec ma carte graphique
    Par Arbisis dans le forum Matériel
    Réponses: 2
    Dernier message: 02/12/2005, 19h44
  5. [TP]Probleme de compilation sous TP7
    Par yffick dans le forum Turbo Pascal
    Réponses: 7
    Dernier message: 18/12/2003, 20h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo