Genital smegma is the natural breakdown of the epithelial layer of cells between the foreskin and glans. It's principally transudated moisture and sloughed cellular material, rich in natural emollients and lysozymes (among other things). As such, the substance has natural anti-viral and anti-bacterial properties. And healthy smegma is not malodorous; it has a faintly sweet scent and is rich in pheromones, particularly after puberty.
Where some people get confused is about further hygiene. Yes, the smegma base can become contaminated with residual urine and semen after puberty, when the preputial space has fully differentiated. Odor comes from decaying bacteria, not healthy, thriving bacteria. This mix in adult males needs to be cleaned with clean, warm water every day or so. If a cleanser is used on the area, it should be a non-detergent, pH-balanced soap product (I personally prefer a couple of types, including Natural Beauty bar from Nature's Plus) that will not irritate or unduly dry out the mucosal tissue. It also allows the natural flora to return more effectively.
Whenever someone brings up the smegma argument with me, I immediately ask whether they're talking about benign, developmental smegma before puberty or adult smegma. They're really two different things, and both inherently beneficial. It's just that as our body develops and changes, so too do hygiene considerations, and we should not mix up the applicable issues. It's also important to clear up any confusion that smegma is a "secretion" from oil glands. There are no such glands under the foreskin or around the glans. Smegma is just natural sloughing that is retained in some areas (like under the penile or clitoral foreskin or in labial folds) or is rubbed off in other areas (circumcised men product just about as much smegma daily, but it rubs off onto their underwear).