1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino * Copyright (c) 2000-2001, Boris Popov
3*86d7f5d3SJohn Marino * All rights reserved.
4*86d7f5d3SJohn Marino *
5*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without
6*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions
7*86d7f5d3SJohn Marino * are met:
8*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright
9*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer.
10*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright
11*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the
12*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution.
13*86d7f5d3SJohn Marino * 3. All advertising materials mentioning features or use of this software
14*86d7f5d3SJohn Marino * must display the following acknowledgement:
15*86d7f5d3SJohn Marino * This product includes software developed by Boris Popov.
16*86d7f5d3SJohn Marino * 4. Neither the name of the author nor the names of any co-contributors
17*86d7f5d3SJohn Marino * may be used to endorse or promote products derived from this software
18*86d7f5d3SJohn Marino * without specific prior written permission.
19*86d7f5d3SJohn Marino *
20*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21*86d7f5d3SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*86d7f5d3SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*86d7f5d3SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24*86d7f5d3SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*86d7f5d3SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*86d7f5d3SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*86d7f5d3SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*86d7f5d3SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*86d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*86d7f5d3SJohn Marino * SUCH DAMAGE.
31*86d7f5d3SJohn Marino *
32*86d7f5d3SJohn Marino * $FreeBSD: src/sys/fs/smbfs/smbfs_subr.c,v 1.1.2.2 2003/01/17 08:20:26 tjr Exp $
33*86d7f5d3SJohn Marino * $DragonFly: src/sys/vfs/smbfs/smbfs_subr.c,v 1.4 2003/08/07 21:54:36 dillon Exp $
34*86d7f5d3SJohn Marino */
35*86d7f5d3SJohn Marino #include <sys/param.h>
36*86d7f5d3SJohn Marino #include <sys/systm.h>
37*86d7f5d3SJohn Marino #include <sys/kernel.h>
38*86d7f5d3SJohn Marino #include <sys/malloc.h>
39*86d7f5d3SJohn Marino #include <machine/clock.h>
40*86d7f5d3SJohn Marino #include <sys/time.h>
41*86d7f5d3SJohn Marino #include <sys/vnode.h>
42*86d7f5d3SJohn Marino #include <sys/sysctl.h>
43*86d7f5d3SJohn Marino #include <sys/iconv.h>
44*86d7f5d3SJohn Marino
45*86d7f5d3SJohn Marino #include <netproto/smb/smb.h>
46*86d7f5d3SJohn Marino #include <netproto/smb/smb_conn.h>
47*86d7f5d3SJohn Marino #include <netproto/smb/smb_subr.h>
48*86d7f5d3SJohn Marino #include <netproto/smb/smb_rq.h>
49*86d7f5d3SJohn Marino #include <netproto/smb/smb_dev.h>
50*86d7f5d3SJohn Marino
51*86d7f5d3SJohn Marino #include "smbfs.h"
52*86d7f5d3SJohn Marino #include "smbfs_node.h"
53*86d7f5d3SJohn Marino #include "smbfs_subr.h"
54*86d7f5d3SJohn Marino
55*86d7f5d3SJohn Marino MALLOC_DEFINE(M_SMBFSDATA, "SMBFS data", "SMBFS private data");
56*86d7f5d3SJohn Marino
57*86d7f5d3SJohn Marino /*
58*86d7f5d3SJohn Marino * Time & date conversion routines taken from msdosfs. Although leap
59*86d7f5d3SJohn Marino * year calculation is bogus, it's sufficient before 2100 :)
60*86d7f5d3SJohn Marino */
61*86d7f5d3SJohn Marino /*
62*86d7f5d3SJohn Marino * This is the format of the contents of the deTime field in the direntry
63*86d7f5d3SJohn Marino * structure.
64*86d7f5d3SJohn Marino * We don't use bitfields because we don't know how compilers for
65*86d7f5d3SJohn Marino * arbitrary machines will lay them out.
66*86d7f5d3SJohn Marino */
67*86d7f5d3SJohn Marino #define DT_2SECONDS_MASK 0x1F /* seconds divided by 2 */
68*86d7f5d3SJohn Marino #define DT_2SECONDS_SHIFT 0
69*86d7f5d3SJohn Marino #define DT_MINUTES_MASK 0x7E0 /* minutes */
70*86d7f5d3SJohn Marino #define DT_MINUTES_SHIFT 5
71*86d7f5d3SJohn Marino #define DT_HOURS_MASK 0xF800 /* hours */
72*86d7f5d3SJohn Marino #define DT_HOURS_SHIFT 11
73*86d7f5d3SJohn Marino
74*86d7f5d3SJohn Marino /*
75*86d7f5d3SJohn Marino * This is the format of the contents of the deDate field in the direntry
76*86d7f5d3SJohn Marino * structure.
77*86d7f5d3SJohn Marino */
78*86d7f5d3SJohn Marino #define DD_DAY_MASK 0x1F /* day of month */
79*86d7f5d3SJohn Marino #define DD_DAY_SHIFT 0
80*86d7f5d3SJohn Marino #define DD_MONTH_MASK 0x1E0 /* month */
81*86d7f5d3SJohn Marino #define DD_MONTH_SHIFT 5
82*86d7f5d3SJohn Marino #define DD_YEAR_MASK 0xFE00 /* year - 1980 */
83*86d7f5d3SJohn Marino #define DD_YEAR_SHIFT 9
84*86d7f5d3SJohn Marino /*
85*86d7f5d3SJohn Marino * Total number of days that have passed for each month in a regular year.
86*86d7f5d3SJohn Marino */
87*86d7f5d3SJohn Marino static u_short regyear[] = {
88*86d7f5d3SJohn Marino 31, 59, 90, 120, 151, 181,
89*86d7f5d3SJohn Marino 212, 243, 273, 304, 334, 365
90*86d7f5d3SJohn Marino };
91*86d7f5d3SJohn Marino
92*86d7f5d3SJohn Marino /*
93*86d7f5d3SJohn Marino * Total number of days that have passed for each month in a leap year.
94*86d7f5d3SJohn Marino */
95*86d7f5d3SJohn Marino static u_short leapyear[] = {
96*86d7f5d3SJohn Marino 31, 60, 91, 121, 152, 182,
97*86d7f5d3SJohn Marino 213, 244, 274, 305, 335, 366
98*86d7f5d3SJohn Marino };
99*86d7f5d3SJohn Marino
100*86d7f5d3SJohn Marino /*
101*86d7f5d3SJohn Marino * Variables used to remember parts of the last time conversion. Maybe we
102*86d7f5d3SJohn Marino * can avoid a full conversion.
103*86d7f5d3SJohn Marino */
104*86d7f5d3SJohn Marino static u_long lasttime;
105*86d7f5d3SJohn Marino static u_long lastday;
106*86d7f5d3SJohn Marino static u_short lastddate;
107*86d7f5d3SJohn Marino static u_short lastdtime;
108*86d7f5d3SJohn Marino
109*86d7f5d3SJohn Marino void
smb_time_local2server(struct timespec * tsp,int tzoff,u_long * seconds)110*86d7f5d3SJohn Marino smb_time_local2server(struct timespec *tsp, int tzoff, u_long *seconds)
111*86d7f5d3SJohn Marino {
112*86d7f5d3SJohn Marino *seconds = tsp->tv_sec - tzoff * 60 /*- tz.tz_minuteswest * 60 -
113*86d7f5d3SJohn Marino (wall_cmos_clock ? adjkerntz : 0)*/;
114*86d7f5d3SJohn Marino }
115*86d7f5d3SJohn Marino
116*86d7f5d3SJohn Marino void
smb_time_server2local(u_long seconds,int tzoff,struct timespec * tsp)117*86d7f5d3SJohn Marino smb_time_server2local(u_long seconds, int tzoff, struct timespec *tsp)
118*86d7f5d3SJohn Marino {
119*86d7f5d3SJohn Marino tsp->tv_sec = seconds + tzoff * 60;
120*86d7f5d3SJohn Marino /*+ tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0)*/;
121*86d7f5d3SJohn Marino }
122*86d7f5d3SJohn Marino
123*86d7f5d3SJohn Marino /*
124*86d7f5d3SJohn Marino * Number of seconds between 1970 and 1601 year
125*86d7f5d3SJohn Marino */
126*86d7f5d3SJohn Marino int64_t DIFF1970TO1601 = 11644473600ULL;
127*86d7f5d3SJohn Marino
128*86d7f5d3SJohn Marino /*
129*86d7f5d3SJohn Marino * Time from server comes as UTC, so no need to use tz
130*86d7f5d3SJohn Marino */
131*86d7f5d3SJohn Marino void
smb_time_NT2local(int64_t nsec,int tzoff,struct timespec * tsp)132*86d7f5d3SJohn Marino smb_time_NT2local(int64_t nsec, int tzoff, struct timespec *tsp)
133*86d7f5d3SJohn Marino {
134*86d7f5d3SJohn Marino smb_time_server2local(nsec / 10000000 - DIFF1970TO1601, 0, tsp);
135*86d7f5d3SJohn Marino }
136*86d7f5d3SJohn Marino
137*86d7f5d3SJohn Marino void
smb_time_local2NT(struct timespec * tsp,int tzoff,int64_t * nsec)138*86d7f5d3SJohn Marino smb_time_local2NT(struct timespec *tsp, int tzoff, int64_t *nsec)
139*86d7f5d3SJohn Marino {
140*86d7f5d3SJohn Marino u_long seconds;
141*86d7f5d3SJohn Marino
142*86d7f5d3SJohn Marino smb_time_local2server(tsp, 0, &seconds);
143*86d7f5d3SJohn Marino *nsec = (((int64_t)(seconds) & ~1) + DIFF1970TO1601) * (int64_t)10000000;
144*86d7f5d3SJohn Marino }
145*86d7f5d3SJohn Marino
146*86d7f5d3SJohn Marino void
smb_time_unix2dos(struct timespec * tsp,int tzoff,u_int16_t * ddp,u_int16_t * dtp,u_int8_t * dhp)147*86d7f5d3SJohn Marino smb_time_unix2dos(struct timespec *tsp, int tzoff, u_int16_t *ddp,
148*86d7f5d3SJohn Marino u_int16_t *dtp, u_int8_t *dhp)
149*86d7f5d3SJohn Marino {
150*86d7f5d3SJohn Marino u_long t, days, year, month, inc;
151*86d7f5d3SJohn Marino u_short *months;
152*86d7f5d3SJohn Marino
153*86d7f5d3SJohn Marino /*
154*86d7f5d3SJohn Marino * If the time from the last conversion is the same as now, then
155*86d7f5d3SJohn Marino * skip the computations and use the saved result.
156*86d7f5d3SJohn Marino */
157*86d7f5d3SJohn Marino smb_time_local2server(tsp, tzoff, &t);
158*86d7f5d3SJohn Marino t &= ~1;
159*86d7f5d3SJohn Marino if (lasttime != t) {
160*86d7f5d3SJohn Marino lasttime = t;
161*86d7f5d3SJohn Marino lastdtime = (((t / 2) % 30) << DT_2SECONDS_SHIFT)
162*86d7f5d3SJohn Marino + (((t / 60) % 60) << DT_MINUTES_SHIFT)
163*86d7f5d3SJohn Marino + (((t / 3600) % 24) << DT_HOURS_SHIFT);
164*86d7f5d3SJohn Marino
165*86d7f5d3SJohn Marino /*
166*86d7f5d3SJohn Marino * If the number of days since 1970 is the same as the last
167*86d7f5d3SJohn Marino * time we did the computation then skip all this leap year
168*86d7f5d3SJohn Marino * and month stuff.
169*86d7f5d3SJohn Marino */
170*86d7f5d3SJohn Marino days = t / (24 * 60 * 60);
171*86d7f5d3SJohn Marino if (days != lastday) {
172*86d7f5d3SJohn Marino lastday = days;
173*86d7f5d3SJohn Marino for (year = 1970;; year++) {
174*86d7f5d3SJohn Marino inc = year & 0x03 ? 365 : 366;
175*86d7f5d3SJohn Marino if (days < inc)
176*86d7f5d3SJohn Marino break;
177*86d7f5d3SJohn Marino days -= inc;
178*86d7f5d3SJohn Marino }
179*86d7f5d3SJohn Marino months = year & 0x03 ? regyear : leapyear;
180*86d7f5d3SJohn Marino for (month = 0; days >= months[month]; month++)
181*86d7f5d3SJohn Marino ;
182*86d7f5d3SJohn Marino if (month > 0)
183*86d7f5d3SJohn Marino days -= months[month - 1];
184*86d7f5d3SJohn Marino lastddate = ((days + 1) << DD_DAY_SHIFT)
185*86d7f5d3SJohn Marino + ((month + 1) << DD_MONTH_SHIFT);
186*86d7f5d3SJohn Marino /*
187*86d7f5d3SJohn Marino * Remember dos's idea of time is relative to 1980.
188*86d7f5d3SJohn Marino * unix's is relative to 1970. If somehow we get a
189*86d7f5d3SJohn Marino * time before 1980 then don't give totally crazy
190*86d7f5d3SJohn Marino * results.
191*86d7f5d3SJohn Marino */
192*86d7f5d3SJohn Marino if (year > 1980)
193*86d7f5d3SJohn Marino lastddate += (year - 1980) << DD_YEAR_SHIFT;
194*86d7f5d3SJohn Marino }
195*86d7f5d3SJohn Marino }
196*86d7f5d3SJohn Marino if (dtp)
197*86d7f5d3SJohn Marino *dtp = lastdtime;
198*86d7f5d3SJohn Marino if (dhp)
199*86d7f5d3SJohn Marino *dhp = (tsp->tv_sec & 1) * 100 + tsp->tv_nsec / 10000000;
200*86d7f5d3SJohn Marino
201*86d7f5d3SJohn Marino *ddp = lastddate;
202*86d7f5d3SJohn Marino }
203*86d7f5d3SJohn Marino
204*86d7f5d3SJohn Marino /*
205*86d7f5d3SJohn Marino * The number of seconds between Jan 1, 1970 and Jan 1, 1980. In that
206*86d7f5d3SJohn Marino * interval there were 8 regular years and 2 leap years.
207*86d7f5d3SJohn Marino */
208*86d7f5d3SJohn Marino #define SECONDSTO1980 (((8 * 365) + (2 * 366)) * (24 * 60 * 60))
209*86d7f5d3SJohn Marino
210*86d7f5d3SJohn Marino static u_short lastdosdate;
211*86d7f5d3SJohn Marino static u_long lastseconds;
212*86d7f5d3SJohn Marino
213*86d7f5d3SJohn Marino void
smb_dos2unixtime(u_int dd,u_int dt,u_int dh,int tzoff,struct timespec * tsp)214*86d7f5d3SJohn Marino smb_dos2unixtime(u_int dd, u_int dt, u_int dh, int tzoff,
215*86d7f5d3SJohn Marino struct timespec *tsp)
216*86d7f5d3SJohn Marino {
217*86d7f5d3SJohn Marino u_long seconds;
218*86d7f5d3SJohn Marino u_long month;
219*86d7f5d3SJohn Marino u_long year;
220*86d7f5d3SJohn Marino u_long days;
221*86d7f5d3SJohn Marino u_short *months;
222*86d7f5d3SJohn Marino
223*86d7f5d3SJohn Marino if (dd == 0) {
224*86d7f5d3SJohn Marino tsp->tv_sec = 0;
225*86d7f5d3SJohn Marino tsp->tv_nsec = 0;
226*86d7f5d3SJohn Marino return;
227*86d7f5d3SJohn Marino }
228*86d7f5d3SJohn Marino seconds = (((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) << 1)
229*86d7f5d3SJohn Marino + ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60
230*86d7f5d3SJohn Marino + ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600
231*86d7f5d3SJohn Marino + dh / 100;
232*86d7f5d3SJohn Marino /*
233*86d7f5d3SJohn Marino * If the year, month, and day from the last conversion are the
234*86d7f5d3SJohn Marino * same then use the saved value.
235*86d7f5d3SJohn Marino */
236*86d7f5d3SJohn Marino if (lastdosdate != dd) {
237*86d7f5d3SJohn Marino lastdosdate = dd;
238*86d7f5d3SJohn Marino days = 0;
239*86d7f5d3SJohn Marino year = (dd & DD_YEAR_MASK) >> DD_YEAR_SHIFT;
240*86d7f5d3SJohn Marino days = year * 365;
241*86d7f5d3SJohn Marino days += year / 4 + 1; /* add in leap days */
242*86d7f5d3SJohn Marino if ((year & 0x03) == 0)
243*86d7f5d3SJohn Marino days--; /* if year is a leap year */
244*86d7f5d3SJohn Marino months = year & 0x03 ? regyear : leapyear;
245*86d7f5d3SJohn Marino month = (dd & DD_MONTH_MASK) >> DD_MONTH_SHIFT;
246*86d7f5d3SJohn Marino if (month < 1 || month > 12) {
247*86d7f5d3SJohn Marino month = 1;
248*86d7f5d3SJohn Marino }
249*86d7f5d3SJohn Marino if (month > 1)
250*86d7f5d3SJohn Marino days += months[month - 2];
251*86d7f5d3SJohn Marino days += ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT) - 1;
252*86d7f5d3SJohn Marino lastseconds = (days * 24 * 60 * 60) + SECONDSTO1980;
253*86d7f5d3SJohn Marino }
254*86d7f5d3SJohn Marino smb_time_server2local(seconds + lastseconds, tzoff, tsp);
255*86d7f5d3SJohn Marino tsp->tv_nsec = (dh % 100) * 10000000;
256*86d7f5d3SJohn Marino }
257*86d7f5d3SJohn Marino
258*86d7f5d3SJohn Marino static int
smb_fphelp(struct mbchain * mbp,struct smb_vc * vcp,struct smbnode * np,int caseopt)259*86d7f5d3SJohn Marino smb_fphelp(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *np,
260*86d7f5d3SJohn Marino int caseopt)
261*86d7f5d3SJohn Marino {
262*86d7f5d3SJohn Marino struct smbmount *smp= np->n_mount;
263*86d7f5d3SJohn Marino struct smbnode **npp = smp->sm_npstack;
264*86d7f5d3SJohn Marino int i, error = 0;
265*86d7f5d3SJohn Marino
266*86d7f5d3SJohn Marino /* simple_lock(&smp->sm_npslock);*/
267*86d7f5d3SJohn Marino i = 0;
268*86d7f5d3SJohn Marino while (np->n_parent) {
269*86d7f5d3SJohn Marino if (i++ == SMBFS_MAXPATHCOMP) {
270*86d7f5d3SJohn Marino /* simple_unlock(&smp->sm_npslock);*/
271*86d7f5d3SJohn Marino return ENAMETOOLONG;
272*86d7f5d3SJohn Marino }
273*86d7f5d3SJohn Marino *npp++ = np;
274*86d7f5d3SJohn Marino np = VTOSMB(np->n_parent);
275*86d7f5d3SJohn Marino }
276*86d7f5d3SJohn Marino /* if (i == 0)
277*86d7f5d3SJohn Marino return smb_put_dmem(mbp, vcp, "\\", 2, caseopt);*/
278*86d7f5d3SJohn Marino while (i--) {
279*86d7f5d3SJohn Marino np = *--npp;
280*86d7f5d3SJohn Marino error = mb_put_uint8(mbp, '\\');
281*86d7f5d3SJohn Marino if (error)
282*86d7f5d3SJohn Marino break;
283*86d7f5d3SJohn Marino error = smb_put_dmem(mbp, vcp, np->n_name, np->n_nmlen, caseopt);
284*86d7f5d3SJohn Marino if (error)
285*86d7f5d3SJohn Marino break;
286*86d7f5d3SJohn Marino }
287*86d7f5d3SJohn Marino /* simple_unlock(&smp->sm_npslock);*/
288*86d7f5d3SJohn Marino return error;
289*86d7f5d3SJohn Marino }
290*86d7f5d3SJohn Marino
291*86d7f5d3SJohn Marino int
smbfs_fullpath(struct mbchain * mbp,struct smb_vc * vcp,struct smbnode * dnp,const char * name,int nmlen)292*86d7f5d3SJohn Marino smbfs_fullpath(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *dnp,
293*86d7f5d3SJohn Marino const char *name, int nmlen)
294*86d7f5d3SJohn Marino {
295*86d7f5d3SJohn Marino int caseopt = SMB_CS_NONE;
296*86d7f5d3SJohn Marino int error;
297*86d7f5d3SJohn Marino
298*86d7f5d3SJohn Marino if (SMB_DIALECT(vcp) < SMB_DIALECT_LANMAN1_0)
299*86d7f5d3SJohn Marino caseopt |= SMB_CS_UPPER;
300*86d7f5d3SJohn Marino if (dnp != NULL) {
301*86d7f5d3SJohn Marino error = smb_fphelp(mbp, vcp, dnp, caseopt);
302*86d7f5d3SJohn Marino if (error)
303*86d7f5d3SJohn Marino return error;
304*86d7f5d3SJohn Marino }
305*86d7f5d3SJohn Marino if (name) {
306*86d7f5d3SJohn Marino error = mb_put_uint8(mbp, '\\');
307*86d7f5d3SJohn Marino if (error)
308*86d7f5d3SJohn Marino return error;
309*86d7f5d3SJohn Marino error = smb_put_dmem(mbp, vcp, name, nmlen, caseopt);
310*86d7f5d3SJohn Marino if (error)
311*86d7f5d3SJohn Marino return error;
312*86d7f5d3SJohn Marino }
313*86d7f5d3SJohn Marino error = mb_put_uint8(mbp, 0);
314*86d7f5d3SJohn Marino return error;
315*86d7f5d3SJohn Marino }
316*86d7f5d3SJohn Marino
317*86d7f5d3SJohn Marino int
smbfs_fname_tolocal(struct smb_vc * vcp,char * name,int nmlen,int caseopt)318*86d7f5d3SJohn Marino smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int nmlen, int caseopt)
319*86d7f5d3SJohn Marino {
320*86d7f5d3SJohn Marino /* if (caseopt & SMB_CS_UPPER)
321*86d7f5d3SJohn Marino iconv_convmem(vcp->vc_toupper, name, name, nmlen);
322*86d7f5d3SJohn Marino else if (caseopt & SMB_CS_LOWER)
323*86d7f5d3SJohn Marino iconv_convmem(vcp->vc_tolower, name, name, nmlen);*/
324*86d7f5d3SJohn Marino if (vcp->vc_tolocal)
325*86d7f5d3SJohn Marino iconv_convmem(vcp->vc_tolocal, name, name, nmlen);
326*86d7f5d3SJohn Marino return 0;
327*86d7f5d3SJohn Marino }
328