/*
- * $Id: getzones.c,v 1.6 2001-08-11 11:47:22 srittau Exp $
+ * $Id: getzones.c,v 1.6.14.1 2004-06-09 01:07:17 bfernhomberg Exp $
*/
#ifdef HAVE_CONFIG_H
#include <netatalk/at.h>
#include <atalk/atp.h>
#include <atalk/util.h>
+#include <atalk/unicode.h>
#include <atalk/zip.h>
void print_zones(short n, char *buf);
*/
void print_zones( short n, char *buf )
{
+ size_t zone_len;
+ char *zone;
+
for ( ; n--; buf += (*buf) + 1 ) {
- printf( "%.*s\n", *buf, buf+1 );
+
+ if ((size_t)(-1) == (zone_len = convert_string_allocate( CH_MAC,
+ CH_UNIX, buf+1, *buf, &zone)) ) {
+ zone_len = *buf;
+ if (( zone = strdup(buf+1)) == NULL ) {
+ perror( "strdup" );
+ exit( 1 );
+ }
+ }
+
+ printf( "%.*s\n", zone_len, zone );
+
+ free(zone);
}
}
/*
- * $Id: nbplkup.c,v 1.4 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: nbplkup.c,v 1.4.14.1 2004-06-09 01:07:17 bfernhomberg Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
#include <stdlib.h>
#endif /* ! sun || ! i386 */
+#include <atalk/unicode.h>
+
char *Obj = "=";
char *Type = "=";
char *Zone = "*";
p++;
}
- printf( "Usage:\t%s [ -A address ] [ -r responses] [ obj:type@zone ]\n", p );
+ printf( "Usage:\t%s [ -A address ] [ -r responses] [-m Mac charset] [ obj:type@zone ]\n", p );
exit( 1 );
}
char *name;
int i, c, nresp = 1000;
struct at_addr addr;
+ char *obj = NULL;
+ size_t obj_len;
+ charset_t chMac = CH_MAC;
+ char * convname;
extern char *optarg;
extern int optind;
memset(&addr, 0, sizeof(addr));
- while (( c = getopt( ac, av, "r:A:" )) != EOF ) {
+ while (( c = getopt( ac, av, "r:A:m:" )) != EOF ) {
switch ( c ) {
case 'A':
if (!atalk_aton(optarg, &addr)) {
case 'r' :
nresp = atoi( optarg );
break;
+ case 'm':
+ if ((charset_t)-1 == (chMac = add_charset(optarg)) ) {
+ fprintf(stderr, "Invalid Mac charset.\n");
+ exit(1);
+ }
+ break;
default :
Usage( av[ 0 ] );
}
if ( ac - optind == 1 ) {
- if ( nbp_name( av[ optind ], &Obj, &Type, &Zone )) {
+ if ((size_t)(-1) == convert_string_allocate( CH_UNIX, chMac,
+ av[ optind ], strlen(av[optind]), &convname))
+ convname = av[ optind ];
+
+ if ( nbp_name( convname, &Obj, &Type, &Zone )) {
Usage( av[ 0 ] );
exit( 1 );
}
exit( -1 );
}
for ( i = 0; i < c; i++ ) {
+
+ if ((size_t)(-1) == (obj_len = convert_string_allocate( chMac,
+ CH_UNIX, nn[ i ].nn_obj, nn[ i ].nn_objlen, &obj)) ) {
+ obj_len = nn[ i ].nn_objlen;
+ if (( obj = strdup(nn[ i ].nn_obj)) == NULL ) {
+ perror( "strdup" );
+ exit( 1 );
+ }
+ }
+
printf( "%31.*s:%-34.*s %u.%u:%u\n",
- nn[ i ].nn_objlen, nn[ i ].nn_obj,
+ obj_len, obj,
nn[ i ].nn_typelen, nn[ i ].nn_type,
ntohs( nn[ i ].nn_sat.sat_addr.s_net ),
nn[ i ].nn_sat.sat_addr.s_node,
nn[ i ].nn_sat.sat_port );
+
+ free(obj);
}
+ free(nn);
return 0;
}
/*
- * $Id: nbprgstr.c,v 1.4 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: nbprgstr.c,v 1.4.14.1 2004-06-09 01:07:17 bfernhomberg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <atalk/netddp.h>
#include <atalk/nbp.h>
#include <atalk/util.h>
+#include <atalk/unicode.h>
void Usage( av0 )
char *av0;
p++;
}
- fprintf( stderr, "Usage: %s [ -A address ] obj:type@zone\n", p );
+ fprintf( stderr, "Usage: %s [ -A address ] [-m Mac charset] [ -p port] obj:type@zone\n", p );
exit( 1 );
}
struct sockaddr_at addr;
struct at_addr ataddr;
char *Obj = 0, *Type = 0, *Zone = 0;
+ char *convname = 0;
int s, c, port = 0;
+ charset_t chMac = CH_MAC;
extern char *optarg;
extern int optind;
memset(&ataddr, 0, sizeof(ataddr));
- while (( c = getopt( ac, av, "p:A:" )) != EOF ) {
+ while (( c = getopt( ac, av, "p:A:m:" )) != EOF ) {
switch ( c ) {
case 'A':
if (!atalk_aton(optarg, &ataddr)) {
}
break;
+ case 'm':
+ if ((charset_t)-1 == (chMac = add_charset(optarg)) ) {
+ fprintf(stderr, "Invalid Mac charset.\n");
+ exit(1);
+ }
+ break;
+
case 'p' :
port = atoi( optarg );
break;
Usage( av[ 0 ] );
}
+ /* Convert the name */
+ if ((size_t)(-1) == convert_string_allocate(CH_UNIX, chMac,
+ av[optind], strlen(av[optind]), &convname))
+ convname = av[optind];
+
/*
* Get the name. If Type or Obj aren't specified, error.
*/
- if ( nbp_name( av[ optind ], &Obj, &Type, &Zone ) || !Obj || !Type ) {
+ if ( nbp_name( convname, &Obj, &Type, &Zone ) || !Obj || !Type ) {
Usage( av[ 0 ] );
}
/*
- * $Id: nbpunrgstr.c,v 1.5 2001-07-31 19:49:02 srittau Exp $
+ * $Id: nbpunrgstr.c,v 1.5.14.1 2004-06-09 01:07:17 bfernhomberg Exp $
*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* All Rights Reserved.
#include <atalk/util.h>
#include <atalk/nbp.h>
+#include <atalk/unicode.h>
+
void Usage( av0 )
char *av0;
{
p++;
}
- fprintf( stderr, "Usage: %s [ -A address ] obj:type@zone\n", p );
+ fprintf( stderr, "Usage: %s [ -A address ] [ -m Mac charset] obj:type@zone\n", p );
exit( 1 );
}
char **av;
{
char *Obj = 0, *Type = 0, *Zone = 0;
+ char *convname = 0;
struct at_addr addr;
int c;
+ charset_t chMac = CH_MAC;
extern char *optarg;
extern int optind;
memset(&addr, 0, sizeof(addr));
- while ((c = getopt(ac, av, "A:")) != EOF) {
+ while ((c = getopt(ac, av, "A:m:")) != EOF) {
switch (c) {
case 'A':
if (!atalk_aton(optarg, &addr)) {
exit(1);
}
break;
+ case 'm':
+ if ((charset_t)-1 == (chMac = add_charset(optarg)) ) {
+ fprintf(stderr, "Invalid Mac charset.\n");
+ exit(1);
+ }
+ break;
+
default:
Usage(av[0]);
break;
Usage( av[ 0 ] );
}
+ /* Convert the name */
+ if ((size_t)(-1) == convert_string_allocate(CH_UNIX, chMac,
+ av[optind], strlen(av[optind]), &convname))
+ convname = av[optind];
+
/*
* Get the name. If Type or Obj aren't specified, error.
*/
- if ( nbp_name( av[optind], &Obj, &Type, &Zone ) || !Obj || !Type ) {
+ if ( nbp_name( convname, &Obj, &Type, &Zone ) || !Obj || !Type ) {
Usage( av[ 0 ] );
}
/*
- * $Id: afp_config.c,v 1.22.6.6 2004-05-04 15:38:24 didg Exp $
+ * $Id: afp_config.c,v 1.22.6.7 2004-06-09 01:07:17 bfernhomberg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
ATP atp;
ASP asp;
char *Obj, *Type = "AFPServer", *Zone = "*";
+ char *convname;
if ((config = (AFPConfig *) calloc(1, sizeof(AFPConfig))) == NULL)
return NULL;
/* register asp server */
Obj = (char *) options->hostname;
- if (nbp_name(options->server, &Obj, &Type, &Zone )) {
+ if ((size_t)-1 ==(convert_string_allocate( options->unixcharset, options->maccharset,
+ options->server, strlen(options->server), &convname)) ) {
+ if ((convname = strdup(options->server)) == NULL ) {
+ LOG(log_error, logtype_afpd, "malloc: %m" );
+ goto serv_free_return;
+ }
+ }
+
+ if (nbp_name(convname, &Obj, &Type, &Zone )) {
LOG(log_error, logtype_afpd, "main: can't parse %s", options->server );
goto serv_free_return;
}
+ free (convname);
/* dup Obj, Type and Zone as they get assigned to a single internal
* buffer by nbp_name */
/*
- * $Id: config.c,v 1.13.6.3 2004-02-14 00:30:51 didg Exp $
+ * $Id: config.c,v 1.13.6.4 2004-06-09 01:07:16 bfernhomberg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <sys/stropts.h>
#endif /* __svr4__ */
+#include <atalk/unicode.h>
#include "interface.h"
#include "multicast.h"
#include "rtmp.h"
struct interface *iface;
struct list *l;
int mode = 0644, fd;
+ size_t len;
+ char *zonename;
if ( cf == NULL ) {
path = _PATH_ATALKDCONF;
ntohs( iface->i_addr.sat_addr.s_net ),
iface->i_addr.sat_addr.s_node );
for ( l = iface->i_rt->rt_zt; l; l = l->l_next ) {
- fprintf( newconf, " -zone \"%.*s\"",
- ((struct ziptab *)l->l_data)->zt_len,
- ((struct ziptab *)l->l_data)->zt_name );
+ /* codepage conversion */
+ if ((size_t)(-1) == (len = convert_string_allocate(CH_MAC, CH_UNIX,
+ ((struct ziptab *)l->l_data)->zt_name,
+ ((struct ziptab *)l->l_data)->zt_len,
+ &zonename)) ) {
+ if ( NULL ==
+ (zonename = strdup(((struct ziptab *)l->l_data)->zt_name))) {
+ LOG(log_error, logtype_atalkd, "malloc: %m" );
+ return( -1 );
+ }
+ len = ((struct ziptab *)l->l_data)->zt_len;
+ }
+ fprintf( newconf, " -zone \"%.*s\"", len, zonename);
+ free(zonename);
}
fprintf( newconf, "\n" );
struct ziptab *zt;
char *zname;
- if (( zname = av[ 0 ] ) == NULL ) {
+ if ( av[ 0 ] == NULL ) {
fprintf( stderr, "No zone.\n" );
return -1;
}
+ /* codepage conversion */
+ if ((size_t)(-1) == convert_string_allocate(CH_UNIX, CH_MAC, av[0], strlen(av[0]), &zname)) {
+ zname = strdup(av[0]);
+ }
+
/*
* Only process "-zone" if this interface has "-seed". We keep our
* list of configured zones in the interface structure. Then we can
fprintf( stderr, "Must specify net-range before zones.\n" );
return -1;
}
+
if (( zt = newzt( strlen( zname ), zname )) == NULL ) {
perror( "newzt" );
return -1;
iface->i_czt->zt_next = zt;
}
}
+ free(zname);
+
return( 2 );
}