aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/smbfs/lib/smb/kiconv.c
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>2001-12-20 16:16:25 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>2001-12-20 16:16:25 +0000
commitdf3342d686a25c2ac043aab1f024ef5f96b52f27 (patch)
tree047ddfc533f4ae21ddcdd454a87abe41ff403b0d /contrib/smbfs/lib/smb/kiconv.c
parentf1b9d12761de3c33754f03e6d2a5bf9f1b40aad9 (diff)
downloadsrc-df3342d686a25c2ac043aab1f024ef5f96b52f27.tar.gz
src-df3342d686a25c2ac043aab1f024ef5f96b52f27.zip
Import smbfs-1.4.2.vendor/smbfs/1.4.2
Notes
Notes: svn path=/vendor/smbfs/dist/; revision=88282 svn path=/vendor/smbfs/1.4.2/; revision=88284; tag=vendor/smbfs/1.4.2
Diffstat (limited to 'contrib/smbfs/lib/smb/kiconv.c')
-rw-r--r--contrib/smbfs/lib/smb/kiconv.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/smbfs/lib/smb/kiconv.c b/contrib/smbfs/lib/smb/kiconv.c
index ce69c84bb72c..e75f664643e7 100644
--- a/contrib/smbfs/lib/smb/kiconv.c
+++ b/contrib/smbfs/lib/smb/kiconv.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kiconv.c,v 1.2 2001/04/16 04:33:01 bp Exp $
+ * $Id: kiconv.c,v 1.3 2001/08/22 03:31:36 bp Exp $
*/
#include <sys/types.h>
@@ -38,6 +38,11 @@
#include <ctype.h>
#include <errno.h>
+#ifdef APPLE
+#include <sys/types.h>
+extern uid_t real_uid, eff_uid;
+#endif
+
int
kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
{
@@ -54,8 +59,17 @@ kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
din.ia_data = table;
din.ia_datalen = 256;
olen = sizeof(dout);
+#ifdef APPLE
+ seteuid(eff_uid); /* restore setuid root briefly */
+ if (sysctlbyname("net.smb.fs.iconv.add", &dout, &olen, &din, sizeof(din)) == -1) {
+ seteuid(real_uid); /* and back to real user */
+ return errno;
+ }
+ seteuid(real_uid); /* and back to real user */
+#else
if (sysctlbyname("kern.iconv.add", &dout, &olen, &din, sizeof(din)) == -1)
return errno;
+#endif
return 0;
}