GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* @param if this is the 'final' name for us, not be be changed again
*/
-void set_local_machine_name(const char* local_name, BOOL perm)
+void set_local_machine_name(const char* local_name, bool perm)
{
- static BOOL already_perm = False;
+ static bool already_perm = False;
fstring tmp_local_machine;
fstrcpy(tmp_local_machine,local_name);
* @param if this is the 'final' name for them, not be be changed again
*/
-void set_remote_machine_name(const char* remote_name, BOOL perm)
+void set_remote_machine_name(const char* remote_name, bool perm)
{
- static BOOL already_perm = False;
+ static bool already_perm = False;
fstring tmp_remote_machine;
if (already_perm)
{
fstring tmp;
int len;
- BOOL is_machine_account = False;
+ bool is_machine_account = False;
/* don't let anonymous logins override the name */
if (! *name)
}
}
-char* sub_get_smb_name( void )
-{
- return smb_user_name;
-}
-
/*******************************************************************
Setup the strings used by substitutions. Called per packet. Ensure
%U name is set correctly also.
{
current_user_info = *pcui;
/* The following is safe as current_user_info.smb_name
- * has already been sanitised in register_vuid. */
+ * has already been sanitised in register_existing_vuid. */
fstrcpy(smb_user_name, current_user_info.smb_name);
}
char* (*fn)( void );
};
-struct api_longvar longvar_table[] = {
+static struct api_longvar longvar_table[] = {
{ "DomainSID", longvar_domainsid },
{ NULL, NULL }
};
static char *automount_path(const char *user_name)
{
- static pstring server_path;
+ pstring server_path;
/* use the passwd entry as the default */
/* this will be the default if WITH_AUTOMOUNT is not used or fails */
DEBUG(4,("Home server path: %s\n", server_path));
- return server_path;
+ return talloc_strdup(talloc_tos(), server_path);
}
/*******************************************************************
static const char *automount_server(const char *user_name)
{
- static pstring server_name;
+ pstring server_name;
const char *local_machine_name = get_local_machine_name();
/* use the local machine name as the default */
DEBUG(4,("Home server: %s\n", server_name));
- return server_name;
+ return talloc_strdup(talloc_tos(), server_name);
}
/****************************************************************************
char *b, *p, *s, *r, *a_string;
fstring pidstr, vnnstr;
struct passwd *pass;
+ char addr[INET6_ADDRSTRLEN];
const char *local_machine_name = get_local_machine_name();
/* workaround to prevent a crash while looking at bug #687 */
a_string = realloc_string_sub(a_string, "%D", r);
break;
case 'I' :
- a_string = realloc_string_sub(a_string, "%I", client_addr());
+ a_string = realloc_string_sub(a_string, "%I",
+ client_addr(addr, sizeof(addr)));
break;
case 'i':
a_string = realloc_string_sub( a_string, "%i", client_socket_addr() );
SAFE_FREE( s );
}
}
+
+/****************************************************************************
+ * Do some standard substitutions in a string.
+ * ****************************************************************************/
+
+void standard_sub_conn(connection_struct *conn, char *str, size_t len)
+{
+ char *s;
+
+ s = alloc_sub_advanced(lp_servicename(SNUM(conn)), conn->user, conn->connectpath,
+ conn->gid, smb_user_name, "", str);
+
+ if ( s ) {
+ strncpy( str, s, len );
+ SAFE_FREE( s );
+ }
+}
+