- memcpy(data, &aint, sizeof( aint ));
- data += sizeof( aint );
- break;
-
- case FILPBIT_DFLEN :
- aint = htonl( st->st_size );
- memcpy(data, &aint, sizeof( aint ));
- data += sizeof( aint );
- break;
-
- case FILPBIT_RFLEN :
- if ( isad ) {
- aint = htonl( ad_getentrylen( adp, ADEID_RFORK ));
- } else {
- aint = 0;
- }
- memcpy(data, &aint, sizeof( aint ));
- data += sizeof( aint );
- break;
-
- /* Current client needs ProDOS info block for this file.
- Use simple heuristic and let the Mac "type" string tell
- us what the PD file code should be. Everything gets a
- subtype of 0x0000 unless the original value was hashed
- to "pXYZ" when we created it. See IA, Ver 2.
- <shirsch@ibm.net> */
- case FILPBIT_PDINFO :
- if ( isad ) {
- memcpy(fdType, ad_entry( adp, ADEID_FINDERI ), 4 );
-
- if ( memcmp( fdType, "TEXT", 4 ) == 0 ) {
- achar = '\x04';
- ashort = 0x0000;
- }
- else if ( memcmp( fdType, "PSYS", 4 ) == 0 ) {
- achar = '\xff';
- ashort = 0x0000;
- }
- else if ( memcmp( fdType, "PS16", 4 ) == 0 ) {
- achar = '\xb3';
- ashort = 0x0000;
- }
- else if ( memcmp( fdType, "BINA", 4 ) == 0 ) {
- achar = '\x00';
- ashort = 0x0000;
- }
- else if ( fdType[0] == 'p' ) {
- achar = fdType[1];
- ashort = (fdType[2] * 256) + fdType[3];
- }
- else {
- achar = '\x00';
- ashort = 0x0000;
- }
- }
- else {
- achar = '\x00';
- ashort = 0x0000;
- }
-
- *data++ = achar;
- *data++ = 0;
- memcpy(data, &ashort, sizeof( ashort ));
- data += sizeof( ashort );
- memset(data, 0, sizeof( ashort ));
- data += sizeof( ashort );
- break;
-
- default :
- if ( isad ) {
- ad_close( adp, ADFLAGS_HF );
+ memcpy(data, &ashort, sizeof( ashort ));
+ data += sizeof( ashort );
+ break;
+
+ case FILPBIT_PDID :
+ memcpy(data, &dir->d_did, sizeof( u_int32_t ));
+ data += sizeof( u_int32_t );
+ break;
+
+ case FILPBIT_CDATE :
+ if (!adp || (ad_getdate(adp, AD_DATE_CREATE, &aint) < 0))
+ aint = AD_DATE_FROM_UNIX(st->st_mtime);
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ break;
+
+ case FILPBIT_MDATE :
+ if ( adp && (ad_getdate(adp, AD_DATE_MODIFY, &aint) == 0)) {
+ if ((st->st_mtime > AD_DATE_TO_UNIX(aint))) {
+ aint = AD_DATE_FROM_UNIX(st->st_mtime);
+ }
+ } else {
+ aint = AD_DATE_FROM_UNIX(st->st_mtime);
+ }
+ memcpy(data, &aint, sizeof( int ));
+ data += sizeof( int );
+ break;
+
+ case FILPBIT_BDATE :
+ if (!adp || (ad_getdate(adp, AD_DATE_BACKUP, &aint) < 0))
+ aint = AD_DATE_START;
+ memcpy(data, &aint, sizeof( int ));
+ data += sizeof( int );
+ break;
+
+ case FILPBIT_FINFO :
+ get_finderinfo(vol, upath, adp, (char *)data);
+ data += ADEDLEN_FINDERI;
+ break;
+
+ case FILPBIT_LNAME :
+ l_nameoff = data;
+ data += sizeof( u_int16_t );
+ break;
+
+ case FILPBIT_SNAME :
+ memset(data, 0, sizeof(u_int16_t));
+ data += sizeof( u_int16_t );
+ break;
+
+ case FILPBIT_FNUM :
+ memcpy(data, &id, sizeof( id ));
+ data += sizeof( id );
+ break;
+
+ case FILPBIT_DFLEN :
+ if (st->st_size > 0xffffffff)
+ aint = 0xffffffff;
+ else
+ aint = htonl( st->st_size );
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ break;
+
+ case FILPBIT_RFLEN :
+ if ( adp ) {
+ if (adp->ad_rlen > 0xffffffff)
+ aint = 0xffffffff;
+ else
+ aint = htonl( adp->ad_rlen);
+ } else {
+ aint = 0;
+ }
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ break;
+
+ /* Current client needs ProDOS info block for this file.
+ Use simple heuristic and let the Mac "type" string tell
+ us what the PD file code should be. Everything gets a
+ subtype of 0x0000 unless the original value was hashed
+ to "pXYZ" when we created it. See IA, Ver 2.
+ <shirsch@adelphia.net> */
+ case FILPBIT_PDINFO :
+ if (afp_version >= 30) { /* UTF8 name */
+ utf8 = kTextEncodingUTF8;
+ utf_nameoff = data;
+ data += sizeof( u_int16_t );
+ aint = 0;
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ }
+ else {
+ if ( adp ) {
+ memcpy(fdType, ad_entry( adp, ADEID_FINDERI ), 4 );
+
+ if ( memcmp( fdType, "TEXT", 4 ) == 0 ) {
+ achar = '\x04';
+ ashort = 0x0000;
+ }
+ else if ( memcmp( fdType, "PSYS", 4 ) == 0 ) {
+ achar = '\xff';
+ ashort = 0x0000;
+ }
+ else if ( memcmp( fdType, "PS16", 4 ) == 0 ) {
+ achar = '\xb3';
+ ashort = 0x0000;
+ }
+ else if ( memcmp( fdType, "BINA", 4 ) == 0 ) {
+ achar = '\x00';
+ ashort = 0x0000;
+ }
+ else if ( fdType[0] == 'p' ) {
+ achar = fdType[1];
+ ashort = (fdType[2] * 256) + fdType[3];
+ }
+ else {
+ achar = '\x00';
+ ashort = 0x0000;
+ }
+ }
+ else {
+ achar = '\x00';
+ ashort = 0x0000;
+ }
+
+ *data++ = achar;
+ *data++ = 0;
+ memcpy(data, &ashort, sizeof( ashort ));
+ data += sizeof( ashort );
+ memset(data, 0, sizeof( ashort ));
+ data += sizeof( ashort );
+ }
+ break;
+ case FILPBIT_EXTDFLEN:
+ aint = htonl(st->st_size >> 32);
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ aint = htonl(st->st_size);
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ break;
+ case FILPBIT_EXTRFLEN:
+ aint = 0;
+ if (adp)
+ aint = htonl(adp->ad_rlen >> 32);
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ if (adp)
+ aint = htonl(adp->ad_rlen);
+ memcpy(data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ break;
+ case FILPBIT_UNIXPR :
+ /* accessmode may change st_mode with ACLs */
+ accessmode( upath, &ma, dir , st);
+
+ aint = htonl(st->st_uid);
+ memcpy( data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+ aint = htonl(st->st_gid);
+ memcpy( data, &aint, sizeof( aint ));
+ data += sizeof( aint );
+
+ /* FIXME: ugly hack
+ type == slnk indicates an OSX style symlink,
+ we have to add S_IFLNK to the mode, otherwise
+ 10.3 clients freak out. */
+
+ aint = st->st_mode;
+ if (adp) {
+ memcpy(fdType, ad_entry( adp, ADEID_FINDERI ), 4 );
+ if ( memcmp( fdType, "slnk", 4 ) == 0 ) {
+ aint |= S_IFLNK;
+ }