1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
Goal: Add an option to not update mtab
Fixes: ?
Status wrt upstream: Should be forwarded
Note: Part of no-longer maintained smbfs stuff?
The manpages are not modified
Index: samba-3.0.25rc2/source/client/smbmnt.c
===================================================================
--- samba-3.0.25rc2.orig/source/client/smbmnt.c 2007-04-24 11:07:52.143973086 +0200
+++ samba-3.0.25rc2/source/client/smbmnt.c 2007-04-24 11:07:53.912033639 +0200
@@ -44,6 +44,7 @@
static uid_t mount_uid;
static gid_t mount_gid;
static int mount_ro;
+static int no_mtab;
static unsigned mount_fmask;
static unsigned mount_dmask;
static int user_mount;
@@ -56,6 +57,7 @@
printf("Usage: smbmnt mount-point [options]\n");
printf("Version %s\n\n",SAMBA_VERSION_STRING);
printf("-s share share name on server\n"
+ "-n don't update /etc/mtab\n"
"-r mount read-only\n"
"-u uid mount as uid\n"
"-g gid mount as gid\n"
@@ -70,7 +72,7 @@
{
int opt;
- while ((opt = getopt (argc, argv, "s:u:g:rf:d:o:")) != EOF)
+ while ((opt = getopt (argc, argv, "s:u:g:nrf:d:o:")) != EOF)
{
switch (opt)
{
@@ -87,6 +89,9 @@
mount_gid = strtol(optarg, NULL, 0);
}
break;
+ case 'n':
+ no_mtab = 1;
+ break;
case 'r':
mount_ro = 1;
break;
@@ -291,36 +296,38 @@
return -1;
}
- if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1)
- {
- fprintf(stderr, "Can't get "MOUNTED"~ lock file");
- return 1;
- }
- close(fd);
+ if (!no_mtab) {
+ if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1)
+ {
+ fprintf(stderr, "Can't get "MOUNTED"~ lock file");
+ return 1;
+ }
+ close(fd);
- if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
- {
- fprintf(stderr, "Can't open " MOUNTED);
- return 1;
- }
+ if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
+ {
+ fprintf(stderr, "Can't open " MOUNTED);
+ return 1;
+ }
- if (addmntent(mtab, &ment) == 1)
- {
- fprintf(stderr, "Can't write mount entry");
- return 1;
- }
- if (fchmod(fileno(mtab), 0644) == -1)
- {
- fprintf(stderr, "Can't set perms on "MOUNTED);
- return 1;
- }
- endmntent(mtab);
+ if (addmntent(mtab, &ment) == 1)
+ {
+ fprintf(stderr, "Can't write mount entry");
+ return 1;
+ }
+ if (fchmod(fileno(mtab), 0644) == -1)
+ {
+ fprintf(stderr, "Can't set perms on "MOUNTED);
+ return 1;
+ }
+ endmntent(mtab);
- if (unlink(MOUNTED"~") == -1)
- {
- fprintf(stderr, "Can't remove "MOUNTED"~");
- return 1;
- }
+ if (unlink(MOUNTED"~") == -1)
+ {
+ fprintf(stderr, "Can't remove "MOUNTED"~");
+ return 1;
+ }
+ }
return 0;
}
Index: samba-3.0.25rc2/source/client/smbmount.c
===================================================================
--- samba-3.0.25rc2.orig/source/client/smbmount.c 2007-04-24 11:07:51.451949299 +0200
+++ samba-3.0.25rc2/source/client/smbmount.c 2007-04-24 11:07:54.208043743 +0200
@@ -48,6 +48,7 @@
static int mount_ro;
static unsigned mount_fmask;
static unsigned mount_dmask;
+static BOOL no_mtab = False;
static BOOL use_kerberos;
/* TODO: Add code to detect smbfs version in kernel */
static BOOL status32_smbfs = False;
@@ -273,6 +274,9 @@
return;
}
+ if (no_mtab)
+ return;
+
if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1) {
DEBUG(0,("%d: Can't get "MOUNTED"~ lock file", sys_getpid()));
return;
@@ -470,6 +474,9 @@
args[i++] = "-s";
args[i++] = svc2;
+ if (no_mtab) {
+ args[i++] = "-n";
+ }
if (mount_ro) {
args[i++] = "-r";
}
@@ -665,7 +672,7 @@
****************************************************************************/
static void usage(void)
{
- printf("Usage: mount.smbfs service mountpoint [-o options,...]\n");
+ printf("Usage: mount.smbfs service mountpoint [-n] [-o options,...]\n");
printf("Version %s\n\n",SAMBA_VERSION_STRING);
@@ -742,8 +749,13 @@
argc -= 2;
argv += 2;
- opt = getopt(argc, argv, "o:");
- if(opt != 'o') {
+ opt = getopt(argc, argv, "no:");
+ if (opt == 'n') {
+ DEBUG(3,("No mtab!\n"));
+ no_mtab = True;
+ opt = getopt(argc, argv, "o:");
+ }
+ if (opt != 'o') {
return;
}
|