View | Details | Raw Unified | Return to bug 46976
Collapse All | Expand All

(-)java/org/apache/catalina/Manager.java (+13 lines)
Lines 363-366 Link Here
363
      */
363
      */
364
     public void backgroundProcess();
364
     public void backgroundProcess();
365
365
366
367
     /**
368
      * This method sets cookie domain for session cookies
369
      *
370
      * @param domain Cookie domain name (Use ".domain.tld" to issue
371
      *               subdomain valid session cookies)
372
      */
373
     public void setCookieDomain (String domain);
374
375
     /**
376
      * Returns cookie domain if set, otherwise null
377
      */
378
     public String getCookieDomain ();
366
}
379
}
(-)java/org/apache/catalina/session/ManagerBase.java (+33 lines)
Lines 197-203 Link Here
197
     */
197
     */
198
    private int count = 0;
198
    private int count = 0;
199
199
200
    /**
201
     * Cookie domain for session cookies
202
     */
203
    protected String cookieDomain = null;
200
204
205
201
    /**
206
    /**
202
     * Frequency of the session expiration, and related manager operations.
207
     * Frequency of the session expiration, and related manager operations.
203
     * Manager operations will be done once for the specified amount of
208
     * Manager operations will be done once for the specified amount of
Lines 668-673 Link Here
668
    }
673
    }
669
674
670
    /**
675
    /**
676
     * This method sets cookie domain for session cookies
677
     *
678
     * @param domain Cookie domain name (Use ".domain.tld" to issue
679
     *               subdomain valid session cookies)
680
     */
681
    public void setCookieDomain (String domain) {
682
	if (domain == null) {
683
            cookieDomain = null;
684
            return;
685
        }
686
687
        // sanitize && apply cookie domain string
688
        domain = domain.trim();
689
        if (domain.length() > 0) {
690
            cookieDomain = domain;
691
        } else {
692
            cookieDomain = null;
693
        }
694
    }
695
696
    /**
697
     * Returns cookie domain if set, otherwise null
698
     */
699
    public String getCookieDomain () {
700
        return cookieDomain;
701
    }
702
703
    /**
671
     * Invalidate all sessions that have expired.
704
     * Invalidate all sessions that have expired.
672
     */
705
     */
673
    public void processExpires() {
706
    public void processExpires() {
(-)java/org/apache/catalina/connector/Request.java (+7 lines)
Lines 2346-2351 Link Here
2346
        } else {
2346
        } else {
2347
            cookie.setPath("/");
2347
            cookie.setPath("/");
2348
        }
2348
        }
2349
2350
        // set cookie domain if manager is associated with cookie domain
2351
	String cookieDomain = context.getManager().getCookieDomain();
2352
	if (cookieDomain != null) {
2353
        	cookie.setDomain(cookieDomain);
2354
	}
2355
2349
        if (isSecure()) {
2356
        if (isSecure()) {
2350
            cookie.setSecure(true);
2357
            cookie.setSecure(true);
2351
        }
2358
        }

Return to bug 46976