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
|
diff -uNr samba-3.0alpha22.orig/source/client/smbmnt.c samba-3.0alpha22/source/client/smbmnt.c
--- samba-3.0alpha22.orig/source/client/smbmnt.c 2003-03-15 12:11:39.000000000 -0600
+++ samba-3.0alpha22/source/client/smbmnt.c 2003-03-15 12:11:49.000000000 -0600
@@ -28,6 +28,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;
@@ -40,6 +41,7 @@
printf("Usage: smbmnt mount-point [options]\n");
printf("Version %s\n\n",VERSION);
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"
@@ -54,7 +56,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)
{
@@ -71,6 +73,9 @@
mount_gid = strtol(optarg, NULL, 0);
}
break;
+ case 'n':
+ no_mtab = 1;
+ break;
case 'r':
mount_ro = 1;
break;
@@ -274,36 +279,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;
}
diff -uNr samba-3.0alpha22.orig/source/client/smbmount.c samba-3.0alpha22/source/client/smbmount.c
--- samba-3.0alpha22.orig/source/client/smbmount.c 2003-03-15 12:04:29.000000000 -0600
+++ samba-3.0alpha22/source/client/smbmount.c 2003-03-15 12:15:10.000000000 -0600
@@ -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;
@@ -467,6 +471,9 @@
args[i++] = "-s";
args[i++] = svc2;
+ if (no_mtab) {
+ args[i++] = "-n";
+ }
if (mount_ro) {
args[i++] = "-r";
}
@@ -662,7 +669,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",VERSION);
@@ -740,8 +747,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;
}
|