summaryrefslogtreecommitdiff
path: root/package/samba/patches/100-samba.patch
blob: 3bfeed359682e7a11bc95aa6063ed87254a95e00 (plain)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
diff -ruN samba-2.0.10.orig/source/include/smb.h samba-2.0.10/source/include/smb.h
--- samba-2.0.10.orig/source/include/smb.h	2001-06-23 10:52:20.000000000 +0200
+++ samba-2.0.10/source/include/smb.h	2006-03-06 22:21:12.000000000 +0100
@@ -115,6 +115,22 @@
  *               Usage:
  *                 DEBUGADD( 2, ("Some additional text.\n") );
  */
+ 
+#ifdef NDEBUG
+
+#define DEBUGLVL( level ) \
+  ( (0 == (level)) \
+   && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) )
+
+#define DEBUG( level, body ) \
+  (void)( (0 == (level)) \
+       && (dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) )) \
+       && (dbgtext body) )
+
+#define DEBUGADD( level, body )	\
+  (void)( (0 == (level)) && (dbgtext body) )
+
+#else
 #define DEBUGLVL( level ) \
   ( (DEBUGLEVEL >= (level)) \
    && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) )
@@ -140,7 +156,7 @@
   (void)( (DEBUGLEVEL >= (level)) && (dbgtext body) )
 
 #endif
-
+#endif
 /* End Debugging code section.
  * -------------------------------------------------------------------------- **
  */
@@ -1612,7 +1628,9 @@
 #define CAP_LOCK_AND_READ    0x0100
 #define CAP_NT_FIND          0x0200
 #define CAP_DFS              0x1000
+#define CAP_W2K_SMBS         0x2000
 #define CAP_LARGE_READX      0x4000
+#define CAP_LARGE_WRITEX     0x8000
 #define CAP_EXTENDED_SECURITY 0x80000000
 
 /* protocol types. It assumes that higher protocols include lower protocols
diff -ruN samba-2.0.10.orig/source/Makefile.in samba-2.0.10/source/Makefile.in
--- samba-2.0.10.orig/source/Makefile.in	2000-03-16 23:57:08.000000000 +0100
+++ samba-2.0.10/source/Makefile.in	2006-03-06 22:21:12.000000000 +0100
@@ -37,8 +37,8 @@
 # set these to where to find various files
 # These can be overridden by command line switches (see smbd(8))
 # or in smb.conf (see smb.conf(5))
-SMBLOGFILE = $(VARDIR)/log.smb
-NMBLOGFILE = $(VARDIR)/log.nmb
+SMBLOGFILE = $(VARDIR)/smb
+NMBLOGFILE = $(VARDIR)/nmb
 CONFIGFILE = $(LIBDIR)/smb.conf
 LMHOSTSFILE = $(LIBDIR)/lmhosts
 DRIVERFILE = $(LIBDIR)/printers.def
@@ -55,7 +55,7 @@
 LOCKDIR = @lockdir@
 
 # The directory where code page definition files go
-CODEPAGEDIR = $(LIBDIR)/codepages
+CODEPAGEDIR = $(BASEDIR)/codepages
 
 # The current codepage definition list.
 CODEPAGELIST= 437 737 775 850 852 861 932 866 949 950 936 1251 ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
@@ -82,6 +82,7 @@
 PROGS2 = bin/rpcclient bin/smbpasswd bin/make_smbcodepage bin/make_unicodemap @WRAP@ @WRAP32@
 MPROGS = @MPROGS@
 PROGS = $(PROGS1) $(PROGS2) $(MPROGS) bin/nmblookup bin/make_printerdef 
+SHAREDPROGS = bin/smbd.shared bin/nmbd.shared bin/smbpasswd.shared
 
 SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script/convert_smbpasswd
 
@@ -159,6 +160,8 @@
            $(RPC_SERVER_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) \
            $(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) $(LIB_OBJ)
 
+SMBDSHARED_OBJ = $(SMBD_OBJ1) $(RPC_SERVER_OBJ) \
+           $(LOCKING_OBJ) $(PROFILE_OBJ) #$(PRINTING_OBJ)
 
 NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
             nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \
@@ -176,6 +179,8 @@
 NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \
            $(LIB_OBJ)
 
+NMBDSHARED_OBJ = $(NMBD_OBJ1)
+
 SWAT_OBJ = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
            web/swat.o $(LIBSMB_OBJ) $(LOCKING_OBJ) \
            $(PARAM_OBJ) $(PASSDB_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) \
@@ -207,6 +212,8 @@
 SMBPASSWD_OBJ = utils/smbpasswd.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
                 $(UBIQX_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(LIB_OBJ)
 
+SMBPASSWDSHARED_OBJ = utils/smbpasswd.o
+
 RPCCLIENT_OBJ = rpcclient/rpcclient.o \
              rpcclient/display.o \
              rpcclient/cmd_lsarpc.o \
@@ -265,6 +272,11 @@
 PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) \
 	    $(RPCCLIENT_OBJ) $(SMBWRAPPER_OBJ) $(SMBTORTURE_OBJ)
 
+LIBSMBSHARED_OBJ = $(LIB_OBJ) $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) \
+		$(PASSDB_OBJ) $(RPC_PARSE_OBJ) #$(RPC_CLIENT_OBJ)
+
+LIBSMB_PICOBJS = $(LIBSMBSHARED_OBJ:.o=.po)
+
 PICOBJS = $(SMBWRAPPER_OBJ:.o=.po)
 PICOBJS32 = $(SMBWRAPPER_OBJ:.o=.po32)
 
@@ -274,6 +286,8 @@
 
 all : CHECK $(SPROGS) $(PROGS) 
 
+shared : CHECK $(SHAREDPROGS)
+
 smbwrapper : CHECK bin/smbsh bin/smbwrapper.@SHLIBEXT@ @WRAP32@
 
 smbtorture : CHECK bin/smbtorture
@@ -359,10 +373,18 @@
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LIBS) 
 
+bin/smbd.shared: $(SMBDSHARED_OBJ) bin/libsmb.@SHLIBEXT@ bin/.dummy
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(SMBDSHARED_OBJ) $(LDFLAGS) $(LIBS) -Lbin -lsmb
+
 bin/nmbd: $(NMBD_OBJ) bin/.dummy
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS)
 
+bin/nmbd.shared: $(NMBDSHARED_OBJ) bin/libsmb.@SHLIBEXT@ bin/.dummy
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(NMBDSHARED_OBJ) $(LDFLAGS) $(LIBS) -Lbin -lsmb
+
 bin/swat: $(SWAT_OBJ) bin/.dummy
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(LIBS) 
@@ -411,6 +433,10 @@
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(LIBS)
 
+bin/smbpasswd.shared: $(SMBPASSWDSHARED_OBJ) bin/libsmb.@SHLIBEXT@ bin/.dummy
+	@echo Linking $@
+	@$(CC) $(FLAGS) -o $@ $(SMBPASSWDSHARED_OBJ) $(LDFLAGS) $(LIBS) -Lbin -lsmb
+
 bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ) bin/.dummy
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(MAKE_SMBCODEPAGE_OBJ) $(LDFLAGS) $(LIBS)
@@ -459,6 +485,10 @@
 	@echo Linking $@
 	@$(CC) $(FLAGS) -o $@ $(SMBSH_OBJ) $(LDFLAGS) $(LIBS)
 
+bin/libsmb.@SHLIBEXT@: $(LIBSMB_PICOBJS) bin/.dummy
+	@echo Linking shared library $@
+	@$(LD) @LDSHFLAGS@ -o $@ $(LIBSMB_PICOBJS) $(LIBS)
+
 install: installbin installman installscripts installcp installswat
 
 installdirs:
@@ -518,7 +548,7 @@
 	ctags `find . -name "*.[ch]" | grep -v /CVS/`
 
 realclean: clean
-	-rm -f config.log $(PROGS) $(SPROGS) bin/.dummy
+	-rm -f config.log $(PROGS) $(SPROGS) $(SHAREDPROGS) bin/.dummy
 	-rmdir bin
 
 distclean: realclean
diff -ruN samba-2.0.10.orig/source/nmbd/nmbd_mynames.c samba-2.0.10/source/nmbd/nmbd_mynames.c
--- samba-2.0.10.orig/source/nmbd/nmbd_mynames.c	2000-03-16 23:59:24.000000000 +0100
+++ samba-2.0.10/source/nmbd/nmbd_mynames.c	2006-03-06 22:21:12.000000000 +0100
@@ -215,8 +215,8 @@
          */
         if( !is_refresh_already_queued( subrec, namerec) )
           refresh_name( subrec, namerec, NULL, NULL, NULL );
-        namerec->data.death_time += lp_max_ttl();
-        namerec->data.refresh_time += MIN(lp_max_ttl(), MAX_REFRESH_TIME);
+        namerec->data.death_time = t + lp_max_ttl();
+        namerec->data.refresh_time = t + MIN(lp_max_ttl(), MAX_REFRESH_TIME);
       }
     }
   }
diff -ruN samba-2.0.10.orig/source/smbd/close.c samba-2.0.10/source/smbd/close.c
--- samba-2.0.10.orig/source/smbd/close.c	2000-04-21 19:43:13.000000000 +0200
+++ samba-2.0.10/source/smbd/close.c	2006-03-06 22:21:12.000000000 +0100
@@ -122,11 +122,11 @@
 		last_reference = True;
 
     fsp->fd_ptr = NULL;
-
+#ifdef PRINTING
 	/* NT uses smbclose to start a print - weird */
 	if (normal_close && fsp->print_file)
 		print_file(conn, fsp);
-
+#endif
 	/* check for magic scripts */
 	if (normal_close) {
 		check_magic(fsp,conn);
diff -ruN samba-2.0.10.orig/source/smbd/ipc.c samba-2.0.10/source/smbd/ipc.c
--- samba-2.0.10.orig/source/smbd/ipc.c	2000-03-30 00:20:06.000000000 +0200
+++ samba-2.0.10/source/smbd/ipc.c	2006-03-06 22:21:12.000000000 +0100
@@ -472,7 +472,7 @@
   PACK(desc,t,v);
 }
 
-
+#ifdef PRINTING
 /****************************************************************************
   get a print queue
   ****************************************************************************/
@@ -1004,7 +1004,7 @@
   
   return True;
 }
-
+#endif
 /****************************************************************************
   get info level for a server list query
   ****************************************************************************/
@@ -1834,7 +1834,7 @@
 
   return(True);
 }
-
+#ifdef PRINTING
 /****************************************************************************
   delete a print job
   Form: <W> <> 
@@ -2091,7 +2091,7 @@
 	
 	return(True);
 }
-
+#endif
 
 /****************************************************************************
   get info about the server
@@ -2756,7 +2756,7 @@
 
   return(True);
 }
-
+#ifdef PRINTING
 /****************************************************************************
   api_WPrintJobEnumerate
   ****************************************************************************/
@@ -3189,7 +3189,7 @@
   DEBUG(4,("WPrintPortEnum: errorcode %d\n",desc.errcode));
   return(True);
 }
-
+#endif
 /****************************************************************************
  Start the first part of an RPC reply which began with an SMBtrans request.
 ****************************************************************************/
@@ -3407,6 +3407,7 @@
   {"RNetUserGetInfo",	56,	api_RNetUserGetInfo,0},
   {"NetUserGetGroups",	59,	api_NetUserGetGroups,0},
   {"NetWkstaGetInfo",	63,	api_NetWkstaGetInfo,0},
+#ifdef PRINTING
   {"DosPrintQEnum",	69,	api_DosPrintQEnum,0},
   {"DosPrintQGetInfo",	70,	api_DosPrintQGetInfo,0},
   {"WPrintQueuePause",  74, api_WPrintQueuePurge,0},
@@ -3418,16 +3419,21 @@
   {"RDosPrintJobResume",83,	api_RDosPrintJobDel,0},
   {"WPrintDestEnum",	84,	api_WPrintDestEnum,0},
   {"WPrintDestGetInfo",	85,	api_WPrintDestGetInfo,0},
+#endif
   {"NetRemoteTOD",	91,	api_NetRemoteTOD,0},
+#ifdef PRINTING
   {"WPrintQueuePurge",	103,	api_WPrintQueuePurge,0},
+#endif
   {"NetServerEnum",	104,	api_RNetServerEnum,0},
   {"WAccessGetUserPerms",105,	api_WAccessGetUserPerms,0},
   {"SetUserPassword",	115,	api_SetUserPassword,0},
   {"WWkstaUserLogon",	132,	api_WWkstaUserLogon,0},
+#ifdef PRINTING
   {"PrintJobInfo",	147,	api_PrintJobInfo,0},
   {"WPrintDriverEnum",	205,	api_WPrintDriverEnum,0},
   {"WPrintQProcEnum",	206,	api_WPrintQProcEnum,0},
   {"WPrintPortEnum",	207,	api_WPrintPortEnum,0},
+#endif
   {"SamOEMChangePassword", 214, api_SamOEMChangePassword,0},
   {NULL,		-1,	api_Unsupported,0}};
 
diff -ruN samba-2.0.10.orig/source/smbd/negprot.c samba-2.0.10/source/smbd/negprot.c
--- samba-2.0.10.orig/source/smbd/negprot.c	2000-03-16 23:59:47.000000000 +0100
+++ samba-2.0.10/source/smbd/negprot.c	2006-03-06 22:21:12.000000000 +0100
@@ -160,7 +160,7 @@
   /* dual names + lock_and_read + nt SMBs + remote API calls */
   int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ|
                      (lp_nt_smb_support() ? CAP_NT_SMBS | CAP_RPC_REMOTE_APIS : 0) |
-                     (SMB_OFF_T_BITS == 64 ? CAP_LARGE_FILES : 0);
+                     (SMB_OFF_T_BITS == 64 ? CAP_LARGE_FILES | CAP_LARGE_READX | CAP_LARGE_WRITEX /*| CAP_W2K_SMBS*/ : 0);
 
 
 /*
diff -ruN samba-2.0.10.orig/source/smbd/password.c samba-2.0.10/source/smbd/password.c
--- samba-2.0.10.orig/source/smbd/password.c	2000-03-16 23:59:48.000000000 +0100
+++ samba-2.0.10/source/smbd/password.c	2006-03-06 22:21:12.000000000 +0100
@@ -1149,7 +1149,7 @@
 
   return(True);
 }
-
+#ifdef RPCCLIENT
 /***********************************************************************
  Connect to a remote machine for domain security authentication
  given a name or IP address.
@@ -1504,3 +1504,4 @@
   cli_shutdown(&cli);
   return True;
 }
+#endif
diff -ruN samba-2.0.10.orig/source/smbd/process.c samba-2.0.10/source/smbd/process.c
--- samba-2.0.10.orig/source/smbd/process.c	2000-04-15 02:21:27.000000000 +0200
+++ samba-2.0.10/source/smbd/process.c	2006-03-06 22:21:12.000000000 +0100
@@ -343,10 +343,12 @@
    {SMBlseek,"SMBlseek",reply_lseek,AS_USER},
    {SMBflush,"SMBflush",reply_flush,AS_USER},
    {SMBctemp,"SMBctemp",reply_ctemp,AS_USER | QUEUE_IN_OPLOCK },
+#ifdef PRINTING
    {SMBsplopen,"SMBsplopen",reply_printopen,AS_USER | QUEUE_IN_OPLOCK },
    {SMBsplclose,"SMBsplclose",reply_printclose,AS_USER},
    {SMBsplretq,"SMBsplretq",reply_printqueue,AS_USER},
    {SMBsplwr,"SMBsplwr",reply_printwrite,AS_USER},
+#endif
    {SMBlock,"SMBlock",reply_lock,AS_USER},
    {SMBunlock,"SMBunlock",reply_unlock,AS_USER},
    
@@ -908,7 +910,7 @@
     DEBUG(2,("Closing idle connection 2.\n"));
     return False;
   }
-
+#ifdef RPCLIENT
   if(global_machine_password_needs_changing)
   {
     unsigned char trust_passwd_hash[16];
@@ -954,7 +956,7 @@
     trust_password_unlock();
     global_machine_password_needs_changing = False;
   }
-
+#endif
   /*
    * Check to see if we have any blocking locks
    * outstanding on the queue.
diff -ruN samba-2.0.10.orig/source/smbd/reply.c samba-2.0.10/source/smbd/reply.c
--- samba-2.0.10.orig/source/smbd/reply.c	2001-06-23 10:51:24.000000000 +0200
+++ samba-2.0.10/source/smbd/reply.c	2006-03-06 22:21:12.000000000 +0100
@@ -597,12 +597,12 @@
 
   if (!check_domain_match(orig_user, domain))
      return False;
-
+#ifdef RPCCLIENT
   ret = domain_client_validate(orig_user, domain,
                                 smb_apasswd, smb_apasslen,
                                 smb_ntpasswd, smb_ntpasslen,
                                 &user_exists);
-
+#endif
   if(ret) {
     /*
      * User validated ok against Domain controller.
@@ -2991,7 +2991,7 @@
 	return -1;
 }
 
-
+#ifdef PRINTING
 /****************************************************************************
   reply to a printopen
 ****************************************************************************/
@@ -3176,7 +3176,7 @@
   
   return(outsize);
 }
-
+#endif
 
 /****************************************************************************
   reply to a mkdir
diff -ruN samba-2.0.10.orig/source/smbd/server.c samba-2.0.10/source/smbd/server.c
--- samba-2.0.10.orig/source/smbd/server.c	2000-03-16 23:59:52.000000000 +0100
+++ samba-2.0.10/source/smbd/server.c	2006-03-06 22:21:12.000000000 +0100
@@ -300,9 +300,9 @@
 	lp_killunused(conn_snum_used);
 
 	ret = lp_load(servicesf,False,False,True);
-
+#ifdef PRINTING
 	load_printers();
-
+#endif
 	/* perhaps the config filename is now set */
 	if (!test)
 		reload_services(True);
diff -ruN samba-2.0.10.orig/source/smbd/service.c samba-2.0.10/source/smbd/service.c
--- samba-2.0.10.orig/source/smbd/service.c	2000-03-16 23:59:52.000000000 +0100
+++ samba-2.0.10/source/smbd/service.c	2006-03-06 22:21:12.000000000 +0100
@@ -121,7 +121,7 @@
       }
      }
    }
-
+#ifdef PRINTING
    /* If we still don't have a service, attempt to add it as a printer. */
    if (iService < 0)
    {
@@ -146,7 +146,7 @@
             DEBUG(3,("%s is not a valid printer name\n", service));
       }
    }
-
+#endif
    /* just possibly it's a default service? */
    if (iService < 0) 
    {
diff -ruN samba-2.0.10.orig/source/utils/smbpasswd.c samba-2.0.10/source/utils/smbpasswd.c
--- samba-2.0.10.orig/source/utils/smbpasswd.c	2000-03-16 23:59:57.000000000 +0100
+++ samba-2.0.10/source/utils/smbpasswd.c	2006-03-06 22:21:12.000000000 +0100
@@ -71,7 +71,7 @@
 	}
 	exit(1);
 }
-
+#ifdef RPCCLIENT
 /*********************************************************
 Join a domain.
 **********************************************************/
@@ -143,7 +143,7 @@
 	
 	return (int)ret;
 }
-
+#endif
 
 static void set_line_buffering(FILE *f)
 {
@@ -335,13 +335,13 @@
 	if((local_flags & (LOCAL_ADD_USER|LOCAL_DELETE_USER)) && ((remote_machine != NULL) || joining_domain)) {
 		usage();
 	}
-	
+#ifdef RPCCLIENT	
 	if(joining_domain) {
 		if (argc != 0)
 			usage();
 		return join_domain(new_domain, remote_machine);
 	}
-
+#endif
 	/*
 	 * Deal with root - can add a user, but only locally.
 	 */
diff -ruN samba-2.0.10.orig/source/web/swat.c samba-2.0.10/source/web/swat.c
--- samba-2.0.10.orig/source/web/swat.c	2000-04-11 19:36:36.000000000 +0200
+++ samba-2.0.10/source/web/swat.c	2006-03-06 22:21:12.000000000 +0100
@@ -357,8 +357,9 @@
                 return 0;
         }
 	iNumNonAutoPrintServices = lp_numservices();
+#ifdef PRINTING
 	load_printers();
-
+#endif
 	return 1;
 }
 
@@ -997,8 +998,9 @@
 	charset_initialise();
 	load_config(True);
 	iNumNonAutoPrintServices = lp_numservices();
+#ifdef PRINTING
 	load_printers();
-
+#endif
 	cgi_setup(SWATDIR, !demo_mode);
 
 	print_header();