summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-16 19:10:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:23 -0500
commit74a07edb505c9f20a93c00da06cb5c997b6b3c8a (patch)
tree443db34b14a6edd4931e18b2fd746ace0acf4ee8 /source3/param
parent4341be45935487a50ff7cde28387f47fe74b13ac (diff)
downloadsamba-74a07edb505c9f20a93c00da06cb5c997b6b3c8a.tar.gz
samba-74a07edb505c9f20a93c00da06cb5c997b6b3c8a.tar.bz2
samba-74a07edb505c9f20a93c00da06cb5c997b6b3c8a.zip
r22266: Fix bug #4512 - we were returning a volume label greater than
32 unicode chars. Windows XP doesn't like that :-). Jeremy (This used to be commit e59b5276b56d6963ddd0598bbd1b15426d2d13e8)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index a049b2d47a..ea434e4768 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -5299,15 +5299,22 @@ struct share_params *snum2params_static(int snum)
A useful volume label function.
********************************************************************/
-char *volume_label(int snum)
+const char *volume_label(int snum)
{
- char *ret = lp_volume(snum);
- if (!*ret)
- return lp_servicename(snum);
- return (ret);
+ char *ret;
+ const char *label = lp_volume(snum);
+ if (!*label) {
+ label = lp_servicename(snum);
+ }
+
+ /* This returns a 33 byte guarenteed null terminated string. */
+ ret = talloc_strndup(main_loop_talloc_get(), label, 32);
+ if (!ret) {
+ return "";
+ }
+ return ret;
}
-
/*******************************************************************
Set the server type we will announce as via nmbd.
********************************************************************/