--- a/source3/Makefile.in
+++ b/source3/Makefile.in
-@@ -1017,7 +1017,7 @@ TEST_LP_LOAD_OBJ = param/test_lp_load.o
+@@ -1025,7 +1025,7 @@ TEST_LP_LOAD_OBJ = param/test_lp_load.o
PASSWD_UTIL_OBJ = utils/passwd_util.o
$(PARAM_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
$(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) \
-@@ -1789,7 +1789,7 @@ nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/
+@@ -1813,7 +1813,7 @@ nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/
echo "$(COMPILE_CC_PATH)" 1>&2;\
$(COMPILE_CC_PATH) >/dev/null 2>&1
@echo Compiling $<.c
@$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\
echo "The following command failed:" 1>&2;\
-@@ -1798,7 +1798,7 @@ utils/smbpasswd_multicall.o: utils/smbpa
+@@ -1822,7 +1822,7 @@ utils/smbpasswd_multicall.o: utils/smbpa
SMBD_MULTI_O = $(patsubst smbd/server.o,smbd/server_multicall.o,$(SMBD_OBJ))
NMBD_MULTI_O = $(patsubst nmbd/nmbd.o,nmbd/nmbd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(NMBD_OBJ)))
MULTICALL_O = $(sort $(SMBD_MULTI_O) $(NMBD_MULTI_O) $(SMBPASSWD_MULTI_O) $(MULTI_O))
--- /dev/null
+++ b/source3/utils/owrt_smbpasswd.c
-@@ -0,0 +1,245 @@
+@@ -0,0 +1,249 @@
+/*
-+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2012 Felix Fietkau <nbd@nbd.name>
+ * Copyright (C) 2008 John Crispin <blogic@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ int len = strlen(buf);
+
+ fgetpos(fp, &r_pos);
-+ w_pos = r_pos;
-+ w_pos.__pos -= len;
++ fseek(fp, -len, SEEK_CUR);
++ fgetpos(fp, &w_pos);
++ fsetpos(fp, &r_pos);
+
+ while (fgets(buf, sizeof(buf) - 1, fp)) {
+ int cur_len = strlen(buf);
+
+ fsetpos(fp, &w_pos);
+ fputs(buf, fp);
-+ r_pos.__pos += cur_len;
-+ w_pos.__pos += cur_len;
++ fgetpos(fp, &w_pos);
++
+ fsetpos(fp, &r_pos);
++ fseek(fp, cur_len, SEEK_CUR);
++ fgetpos(fp, &r_pos);
+ }
+
-+ ftruncate(fileno(fp), w_pos.__pos);
++ fsetpos(fp, &w_pos);
++ ftruncate(fileno(fp), ftello(fp));
+}
+
+static int usage(const char *progname)