RSS

(root)/fsp/fsplib : 21

hsn
2005-02-19 18:10:28
Revision ID: cvs-1:hsn-20050219181028-n5khnsbtjqarxgga
0.6 release

collapse all collapse all

added added

removed removed

 
 
1
0.6
 
 
2
        SCons build framework now has full support for distcc and ccache
 
 
3
        seq. number is now random
 
 
4
        test received filepos
 
 
5
        test received command reply
 
 
6
        fixed typo in configure.ac
 
 
7
        ./test program can take optional port number
1
0.5
8
0.5
2
        new configure tests for stdint.h patch from Brian Masney
9
        new configure tests for stdint.h patch from Brian Masney
3
        SCons build framework improved, now support CC from command line
10
        SCons build framework improved, now support CC from command line
 
 
1
0.6
 
 
2
     make more tests on received packet -- improve resistance against certain
 
 
3
       kind of attacks.
 
 
4
     SCons build framework improved
 
 
5
     fixed typo in configure.ac
1
0.5
6
0.5
2
     use stdint.h if avaiable - should fix Mac OSX build problem
7
     use stdint.h if avaiable - should fix Mac OSX build problem
3
     SCons build framework improved
8
     SCons build framework improved
5
     Added build time checks for various members of dirent structure.
10
     Added build time checks for various members of dirent structure.
6
     fsplib should built on IRIX as result.
11
     fsplib should built on IRIX as result.
7
0.3
12
0.3
8
     scons build system fix: prefix now works, fixed install target,
13
     SCons build system fix: prefix now works, fixed install target,
9
       compile with -O by default
14
       compile with -O by default
10
     Filter symlinks from non native directory listings
15
     Filter symlinks from non native directory listings
11
0.2
16
0.2
5
EnsureSConsVersion(0,96)
5
EnsureSConsVersion(0,96)
6
PREFIX='/usr/local'
6
PREFIX='/usr/local'
7
PACKAGE='fsplib'
7
PACKAGE='fsplib'
8
VERSION='0.5'
8
VERSION='0.6'
9
 
9
 
10
env = Environment()
10
env = Environment()
11
# Turn CPPFLAGS to list
11
# Turn CPPFLAGS to list
1
high priority
1
high priority
2
=============
2
=============
3
 
3
 
4
do more checking on received packet, check filepos also.
 
 
5
 
 
 
6
low priority
4
low priority
7
============
5
============
8
 
6
 
12
 
10
 
13
cache server flag bits (i.e. readonly, ...) and max. packet size
11
cache server flag bits (i.e. readonly, ...) and max. packet size
14
 
12
 
 
 
13
large packets
 
 
14
 
15
errno
15
errno
16
=====
16
=====
17
 
17
 
1
# Process this file with autoconf to produce a configure script.
1
# Process this file with autoconf to produce a configure script.
2
 
2
 
3
AC_PREREQ(2.59)
3
AC_PREREQ(2.59)
4
AC_INIT(fsplib,0.5,hsn@netmag.cz)
4
AC_INIT(fsplib,0.6,hsn@netmag.cz)
5
AM_INIT_AUTOMAKE()
5
AM_INIT_AUTOMAKE()
6
AM_MAINTAINER_MODE
6
AM_MAINTAINER_MODE
7
AC_CONFIG_SRCDIR([fsplib.c])
7
AC_CONFIG_SRCDIR([fsplib.c])
47
CFLAGS="$CFLAGS $ac_cv_prog_gcc_flags"
47
CFLAGS="$CFLAGS $ac_cv_prog_gcc_flags"
48
if test "${enable_maintainer_mode+set}" = set; then
48
if test "${enable_maintainer_mode+set}" = set; then
49
   CFLAGS="-g3 -O0 -DMAINTAINER_MODE $ac_cv_prog_gcc_flags"
49
   CFLAGS="-g3 -O0 -DMAINTAINER_MODE $ac_cv_prog_gcc_flags"
50
AC_CHECK_LIB(efence,EF_Abort)
50
   AC_CHECK_LIB(efence,EF_Abort)
51
fi
51
fi
52
 
52
 
53
# Checks for libraries.
53
# Checks for libraries.
54
 
54
 
55
# Checks for header files.
55
# Checks for header files.
56
C_CHECK_HEADERS(stdint.h)
56
AC_CHECK_HEADERS(stdint.h)
57
 
57
 
58
# Checks for typedefs, structures, and compiler characteristics.
58
# Checks for typedefs, structures, and compiler characteristics.
59
AC_CHECK_MEMBER(struct dirent.d_namlen,AC_DEFINE(HAVE_DIRENT_NAMLEN,1,[Define if struct dirent has member d_namlen]),,[#include <sys/types.h>
59
AC_CHECK_MEMBER(struct dirent.d_namlen,AC_DEFINE(HAVE_DIRENT_NAMLEN,1,[Define if struct dirent has member d_namlen]),,[#include <sys/types.h>
87
       return -1;
87
       return -1;
88
   }
88
   }
89
 
89
 
90
   if(in.cmd != command)
 
 
91
   {
 
 
92
       errno = ENOMSG;
 
 
93
       return -1;
 
 
94
   }
 
 
95
 
 
 
96
   errno = 0;
90
   errno = 0;
97
   return  0;
91
   return  0;
98
}
92
}
250
    /* get the next key */
244
    /* get the next key */
251
    p->key = client_get_key((FSP_LOCK *)s->lock);
245
    p->key = client_get_key((FSP_LOCK *)s->lock);
252
 
246
 
 
 
247
    retry = random() & 0xfff8;
 
 
248
    if (s->seq == retry)
 
 
249
        s->seq ^= 0x1080;
 
 
250
    else
 
 
251
        s->seq = retry; 
253
    dupes = retry = 0;
252
    dupes = retry = 0;
254
    s->seq = (s-> seq + 0x08) & 0xfff8;
 
 
255
    t_delay = 0;
253
    t_delay = 0;
256
    /* compute initial delay here */
254
    /* compute initial delay here */
257
    /* we are using hardcoded value for now */
255
    /* we are using hardcoded value for now */
363
                continue;
361
                continue;
364
            }
362
            }
365
 
363
 
 
 
364
            /* check command code */
 
 
365
            if( (rpkt->cmd != p->cmd) && (rpkt->cmd != FSP_CC_ERR))
 
 
366
            {
 
 
367
                dupes++;
 
 
368
                continue;
 
 
369
            }
 
 
370
 
 
 
371
            /* check correct filepos */
 
 
372
            if( (rpkt->pos != p->pos) && ( p->cmd == FSP_CC_GET_DIR ||
 
 
373
                p->cmd == FSP_CC_GET_FILE || p->cmd == FSP_CC_UP_LOAD ||
 
 
374
                p->cmd == FSP_CC_GRAB_FILE || p->cmd == FSP_CC_INFO) )
 
 
375
            {
 
 
376
                dupes++;
 
 
377
                continue;
 
 
378
            }
 
 
379
 
366
            /* now we have a correct packet */
380
            /* now we have a correct packet */
367
 
381
 
368
            /* compute rtt delay */
382
            /* compute rtt delay */
460
    s->fd=fd;
474
    s->fd=fd;
461
    s->timeout=300000; /* 5 minutes */
475
    s->timeout=300000; /* 5 minutes */
462
    s->maxdelay=60000; /* 1 minute  */
476
    s->maxdelay=60000; /* 1 minute  */
463
    s->seq=random();
477
    s->seq=random() & 0xfff8;
464
    if ( password ) 
478
    if ( password ) 
465
        s->password = strdup(password);
479
        s->password = strdup(password);
466
    return s;
480
    return s;
524
            pos = -1;
538
            pos = -1;
525
            break;
539
            break;
526
        }
540
        }
527
        if ( in.cmd != FSP_CC_GET_DIR )
541
        if ( in.cmd == FSP_CC_ERR )
528
        {
542
        {
529
            /* bad reply from the server */
543
            /* bad reply from the server */
530
            pos = -1;
544
            pos = -1;
569
                free(dir->data);
583
                free(dir->data);
570
            free(dir);
584
            free(dir);
571
        }
585
        }
 
 
586
        errno = EPERM;
572
        return NULL;
587
        return NULL;
573
    }
588
    }
574
 
589
 
576
    dir->blocksize=blocksize;
591
    dir->blocksize=blocksize;
577
    dir->dirname=strdup(dirname);
592
    dir->dirname=strdup(dirname);
578
    dir->datasize=pos;
593
    dir->datasize=pos;
579
 
594
    
 
 
595
    errno = 0;
580
    return dir;
596
    return dir;
581
}
597
}
582
 
598
 
850
                 file->err=1;
866
                 file->err=1;
851
                 return done/size;
867
                 return done/size;
852
            }
868
            }
853
            if(file->in.cmd != FSP_CC_GET_FILE)
869
            if(file->in.cmd == FSP_CC_ERR)
854
            {
870
            {
855
                errno = EIO;
871
                errno = EIO;
856
                file->err=1;
872
                file->err=1;
916
                 file->err=1;
932
                 file->err=1;
917
                 return done/size;
933
                 return done/size;
918
            }
934
            }
919
            if(file->in.cmd != FSP_CC_UP_LOAD)
935
            if(file->in.cmd == FSP_CC_ERR)
920
            {
936
            {
921
                errno = EIO;
937
                errno = EIO;
922
                file->err=1;
938
                file->err=1;
985
         file->err=1;
1001
         file->err=1;
986
         return -1;
1002
         return -1;
987
    }
1003
    }
988
    if(file->in.cmd != FSP_CC_UP_LOAD)
1004
    if(file->in.cmd == FSP_CC_ERR)
989
    {
1005
    {
990
        errno = EIO;
1006
        errno = EIO;
991
        file->err=1;
1007
        file->err=1;
1140
                rc=-1;
1156
                rc=-1;
1141
            } else
1157
            } else
1142
            {
1158
            {
1143
                if(in.cmd != FSP_CC_INSTALL)
1159
                if(in.cmd == FSP_CC_ERR)
1144
                {
1160
                {
1145
                    rc=-1;
1161
                    rc=-1;
1146
                    errno = EPERM;
1162
                    errno = EPERM;
1164
   if(fsp_transaction(s,&out,&in))
1180
   if(fsp_transaction(s,&out,&in))
1165
       return -1;
1181
       return -1;
1166
 
1182
 
1167
   if(in.cmd != FSP_CC_GET_PRO || in.pos != FSP_PRO_BYTES)
1183
   if(in.cmd == FSP_CC_ERR)
 
 
1184
   {
 
 
1185
       errno = ENOENT;
 
 
1186
       return -1;
 
 
1187
   }
 
 
1188
   if(in.pos != FSP_PRO_BYTES)
1168
   {
1189
   {
1169
       errno = ENOMSG;
1190
       errno = ENOMSG;
1170
       return -1;
1191
       return -1;
1190
   if(fsp_transaction(s,&out,&in))
1211
   if(fsp_transaction(s,&out,&in))
1191
       return -1;
1212
       return -1;
1192
 
1213
 
1193
   if(in.cmd != FSP_CC_STAT)
1214
   if(in.cmd == FSP_CC_ERR)
1194
   {
1215
   {
1195
       errno = ENOTSUP;
1216
       errno = ENOTSUP;
1196
       return -1;
1217
       return -1;
1272
   if(fsp_transaction(s,&out,&in))
1293
   if(fsp_transaction(s,&out,&in))
1273
       return -1;
1294
       return -1;
1274
 
1295
 
1275
   if(in.cmd != FSP_CC_RENAME)
1296
   if(in.cmd == FSP_CC_ERR)
1276
   {
1297
   {
1277
       errno = EPERM;
1298
       errno = EPERM;
1278
       return -1;
1299
       return -1;
2
#include <assert.h>
2
#include <assert.h>
3
#include <dirent.h>
3
#include <dirent.h>
4
#include <unistd.h>
4
#include <unistd.h>
 
 
5
#include <stdlib.h>
5
#include <sys/stat.h>
6
#include <sys/stat.h>
6
#include "fsplib.h"
7
#include "fsplib.h"
7
 
8
 
14
    FSP_FILE *f;
15
    FSP_FILE *f;
15
    struct dirent *d;
16
    struct dirent *d;
16
    FSP_DIR *dir;
17
    FSP_DIR *dir;
 
 
18
    int port=2000;
17
    
19
    
18
    printf("Checking for fsp/udp service\n");
20
    printf("Checking for fsp/udp service\n");
19
    s=fsp_open_session("localhost",0,NULL);
21
    s=fsp_open_session("localhost",0,NULL);
20
    assert(s);
22
    assert(s);
21
    fsp_close_session(s);
23
    fsp_close_session(s);
22
 
24
    
23
    printf("Running tests against fspd on localhost 2000\n");
25
    if(argc>1)
24
    s=fsp_open_session("localhost",2000,NULL);
26
        port=atoi(argv[1]);
 
 
27
    printf("Running tests against fspd on localhost %d\n",port);
 
 
28
    s=fsp_open_session("localhost",port,NULL);
25
    assert(s);
29
    assert(s);
26
    s->timeout=9000;
30
    s->timeout=9000;
27
 
31
 

Loggerhead is a web-based interface for Bazaar branches